diff options
author | James Molloy <james.molloy@arm.com> | 2016-08-30 10:56:08 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-08-30 10:56:08 +0000 |
commit | d13b1239e4e4c1a653d3b7549aff679892a7f727 (patch) | |
tree | 2bde42a1c7b5468ae75e57a9ba44a5e08aed7da9 /llvm/lib/Transforms | |
parent | 002572318938f74bb0177dd83d24a59b1cdd013d (diff) | |
download | bcm5719-llvm-d13b1239e4e4c1a653d3b7549aff679892a7f727.tar.gz bcm5719-llvm-d13b1239e4e4c1a653d3b7549aff679892a7f727.zip |
[SimplifyCFG] Properly CSE metadata in SinkThenElseCodeToEnd
This was missing, meaning the metadata in sunk instructions was potentially bogus and could cause miscompiles.
llvm-svn: 280072
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 59f416ebf0f..28686418a4c 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1533,6 +1533,11 @@ static void sinkLastInstruction(ArrayRef<BasicBlock*> Blocks) { I0->getOperandUse(O).set(NewOperands[O]); I0->moveBefore(&*BBEnd->getFirstInsertionPt()); + // Update metadata. + for (auto *I : Insts) + if (I != I0) + combineMetadataForCSE(I0, I); + if (!isa<StoreInst>(I0)) { // canSinkLastInstruction checked that all instructions were used by // one and only one PHI node. Find that now, RAUW it to our common |