From 070e540a3e7eb67d874444ade78bf007c4764aa5 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Fri, 16 Mar 2012 03:16:56 +0000 Subject: LSR fix: Add isSimplifiedLoopNest to IVUsers analysis. Only record IVUsers that are dominated by simplified loop headers. Otherwise SCEVExpander will crash while looking for a preheader. I previously tried to work around this in LSR itself, but that was insufficient. This way, LSR can continue to run if some uses are not in simple loops, as long as we don't attempt to analyze those users. Fixes Segmentation fault: 11 in LoopStrengthReduce llvm-svn: 152892 --- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Utils') diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index 20eef3c0dca..e00565d5f9a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -231,8 +231,10 @@ void SimplifyIndvar::eliminateIVRemainder(BinaryOperator *Rem, // Inform IVUsers about the new users. if (IU) { - if (Instruction *I = dyn_cast(Rem->getOperand(0))) - IU->AddUsersIfInteresting(I); + if (Instruction *I = dyn_cast(Rem->getOperand(0))) { + SmallPtrSet SimplifiedLoopNests; + IU->AddUsersIfInteresting(I, SimplifiedLoopNests); + } } DEBUG(dbgs() << "INDVARS: Simplified rem: " << *Rem << '\n'); ++NumElimRem; -- cgit v1.2.3