[llvm] r278872 - SimplifyCFG: Avoid dereferencing end()
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 16:57:56 PDT 2016
Author: dexonsmith
Date: Tue Aug 16 18:57:56 2016
New Revision: 278872
URL: http://llvm.org/viewvc/llvm-project?rev=278872&view=rev
Log:
SimplifyCFG: Avoid dereferencing end()
When comparing a User* to a BasicBlock::iterator in
passingValueIsAlwaysUndefined, don't dereference the iterator in case it
is end().
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=278872&r1=278871&r2=278872&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Tue Aug 16 18:57:56 2016
@@ -5499,7 +5499,10 @@ static bool passingValueIsAlwaysUndefine
// Now make sure that there are no instructions in between that can alter
// control flow (eg. calls)
- for (BasicBlock::iterator i = ++BasicBlock::iterator(I); &*i != Use; ++i)
+ for (BasicBlock::iterator
+ i = ++BasicBlock::iterator(I),
+ UI = BasicBlock::iterator(dyn_cast<Instruction>(Use));
+ i != UI; ++i)
if (i == I->getParent()->end() || i->mayHaveSideEffects())
return false;
More information about the llvm-commits
mailing list