diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-31 06:57:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-31 06:57:37 +0000 |
commit | b0b822c44935f9381b4b32baa6324d445067f98a (patch) | |
tree | fadfdad1eadf7612bc6491517e5e5b34d85bf211 | |
parent | f3a1c15b750c63accd3597b42d73792458b247a9 (diff) | |
download | external_llvm-b0b822c44935f9381b4b32baa6324d445067f98a.zip external_llvm-b0b822c44935f9381b4b32baa6324d445067f98a.tar.gz external_llvm-b0b822c44935f9381b4b32baa6324d445067f98a.tar.bz2 |
fix some cases where instcombine would change hte IR but not return true
from runOnFunction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80562 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d17abdf..b4bb0a8 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -164,6 +164,7 @@ namespace { public InstVisitor<InstCombiner, Instruction*> { TargetData *TD; bool MustPreserveLCSSA; + bool MadeIRChange; public: /// Worklist - All of the instructions that need to be simplified. InstCombineWorklist Worklist; @@ -339,6 +340,7 @@ namespace { } Worklist.Remove(&I); I.eraseFromParent(); + MadeIRChange = true; return 0; // Don't do anything with FI } @@ -12676,7 +12678,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB, } bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { - bool Changed = false; + MadeIRChange = false; TD = getAnalysisIfAvailable<TargetData>(); DEBUG(errs() << "\n\nINSTCOMBINE ITERATION #" << Iteration << " on " @@ -12703,7 +12705,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { // going to do one without it. if (!isa<DbgInfoIntrinsic>(I)) { ++NumDeadInst; - Changed = true; + MadeIRChange = true; } if (!I->use_empty()) I->replaceAllUsesWith(UndefValue::get(I->getType())); @@ -12721,7 +12723,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { DEBUG(errs() << "IC: DCE: " << *I << '\n'); EraseInstFromFunction(*I); ++NumDeadInst; - Changed = true; + MadeIRChange = true; continue; } @@ -12733,7 +12735,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { ReplaceInstUsesWith(*I, C); ++NumConstProp; EraseInstFromFunction(*I); - Changed = true; + MadeIRChange = true; continue; } @@ -12745,7 +12747,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { F.getContext(), TD)) if (NewC != CE) { i->set(NewC); - Changed = true; + MadeIRChange = true; } } @@ -12768,7 +12770,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { if (UserIsSuccessor && !isa<PHINode>(I->use_back()) && next(pred_begin(UserParent)) == pred_end(UserParent)) // Okay, the CFG is simple enough, try to sink this instruction. - Changed |= TryToSinkInstruction(I, UserParent); + MadeIRChange |= TryToSinkInstruction(I, UserParent); } } @@ -12823,12 +12825,12 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { Worklist.AddUsersToWorkList(*I); } } - Changed = true; + MadeIRChange = true; } } Worklist.Zap(); - return Changed; + return MadeIRChange; } |