diff options
author | Hans Wennborg <hans@hanshq.net> | 2016-05-04 15:40:57 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2016-05-04 15:40:57 +0000 |
commit | 0c3518e84b668975df03ac8b9620d7bf181bd349 (patch) | |
tree | 1a167bf2ee58ca52258c82ee47bd568cb832c2fb /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 0a7c9d110c9e755c535741d42dfc4c266e3aee7b (diff) | |
download | bcm5719-llvm-0c3518e84b668975df03ac8b9620d7bf181bd349.tar.gz bcm5719-llvm-0c3518e84b668975df03ac8b9620d7bf181bd349.zip |
[SimplifyCFG] isSafeToSpeculateStore now ignores debug info
This patch fixes PR27615.
@llvm.dbg.value instructions no longer count towards the maximum number of
instructions to look back at in the instruction list when searching for a
store instruction. This should make the output consistent between debug and
non-debug build.
Patch by Henric Karlsson <henric.karlsson@ericsson.com>!
Differential Revision: http://reviews.llvm.org/D19912
llvm-svn: 268512
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 6ac039d8a1a..6d347d624e2 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1448,10 +1448,14 @@ static Value *isSafeToSpeculateStore(Instruction *I, BasicBlock *BrBB, Value *StorePtr = StoreToHoist->getPointerOperand(); // Look for a store to the same pointer in BrBB. - unsigned MaxNumInstToLookAt = 10; + unsigned MaxNumInstToLookAt = 9; for (BasicBlock::reverse_iterator RI = BrBB->rbegin(), - RE = BrBB->rend(); RI != RE && (--MaxNumInstToLookAt); ++RI) { + RE = BrBB->rend(); RI != RE && MaxNumInstToLookAt; ++RI) { Instruction *CurI = &*RI; + // Skip debug info. + if (isa<DbgInfoIntrinsic>(CurI)) + continue; + --MaxNumInstToLookAt; // Could be calling an instruction that effects memory like free(). if (CurI->mayHaveSideEffects() && !isa<StoreInst>(CurI)) |