diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-07-31 20:43:07 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-07-31 20:43:07 +0000 |
commit | bcd204b47887e159981b89ab65c29cd939b77d6c (patch) | |
tree | c0d16d8b893cf379c2a5445057b3f70bc12ef2f6 /llvm/lib | |
parent | f3ed393d699ab13a31a91a7989ae2a5819195b1f (diff) | |
download | bcm5719-llvm-bcd204b47887e159981b89ab65c29cd939b77d6c.tar.gz bcm5719-llvm-bcd204b47887e159981b89ab65c29cd939b77d6c.zip |
Update phi nodes in LowerTypeTests control flow simplification
D33925 added a control flow simplification for -O2 --lto-O0 builds that
manually splits blocks and reassigns conditional branches but does not
correctly update phi nodes. If the else case being branched to had
incoming phi nodes the control-flow simplification would leave phi nodes
in that BB with an unhandled predecessor.
Patch by Vlad Tsyrklevich!
Differential Revision: https://reviews.llvm.org/D36012
llvm-svn: 309621
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index cdda8a68ecc..21f1ed881d2 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -634,6 +634,10 @@ Value *LowerTypeTestsModule::lowerTypeTestCall(Metadata *TypeId, CallInst *CI, Br->getMetadata(LLVMContext::MD_prof)); ReplaceInstWithInst(InitialBB->getTerminator(), NewBr); + // Update phis in Else resulting from InitialBB being split + for (auto &Phi : Else->phis()) + Phi.addIncoming(Phi.getIncomingValueForBlock(Then), InitialBB); + IRBuilder<> ThenB(CI); return createBitSetTest(ThenB, TIL, BitOffset); } |