Author: Jeremy Morse Date: 2021-08-05T10:35:08+01:00 New Revision: 692f875535db1d79e5cb9c3862a6cad0228d04e7
URL: https://github.com/llvm/llvm-project/commit/692f875535db1d79e5cb9c3862a6cad0228d04e7 DIFF: https://github.com/llvm/llvm-project/commit/692f875535db1d79e5cb9c3862a6cad0228d04e7.diff LOG: Follow-up to D105207, only salvage affine SCEVs to avoid a crash SCEVToIterCountExpr only expects to be fed affine expressions, but DbgRewriteSalvageableDVIs is feeding it non-affine induction variables. Following this up with an obvious fix, will add test coverage too if this avoids D105207 being reverted. (cherry picked from commit 2537120c870c04893636f171f553024f378c2de8) Added: Modified: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Removed: ################################################################################ diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index a56a4d736f68..1ea4e116bd2f 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -6162,6 +6162,9 @@ DbgRewriteSalvageableDVIs(llvm::Loop *L, ScalarEvolution &SE, bool Changed = false; if (const SCEVAddRecExpr *IVAddRec = dyn_cast<SCEVAddRecExpr>(SCEVInductionVar)) { + if (!IVAddRec->isAffine()) + return false; + SCEVDbgValueBuilder IterCountExpr; IterCountExpr.pushValue(LSRInductionVar); if (!IterCountExpr.SCEVToIterCountExpr(*IVAddRec, SE)) _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits