diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2017-03-15 18:22:37 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2017-03-15 18:22:37 +0000 |
commit | 07f247b6c2047c3dc7b6dce87f93456f776c7ff6 (patch) | |
tree | c31ae228ba22644e36bef1408e31b1242e93df99 /llvm/lib/CodeGen/GlobalISel | |
parent | a61c214f51680bf20ab75eee0e399d3df5e3b6e7 (diff) | |
download | bcm5719-llvm-07f247b6c2047c3dc7b6dce87f93456f776c7ff6.tar.gz bcm5719-llvm-07f247b6c2047c3dc7b6dce87f93456f776c7ff6.zip |
[GlobalISel] Insert translated switch icmp blocks after switch parent.
Now that we preserve the IR layout, we would end up with all the newly
synthesized switch comparison blocks at the end of the function.
Instead, use a hopefully more reasonable layout, with the comparison
blocks immediately following the switch comparison blocks.
llvm-svn: 297869
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 2bcb5559101..353c4a22fe6 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -258,7 +258,8 @@ bool IRTranslator::translateSwitch(const User &U, MachineBasicBlock *FalseMBB = MF->CreateMachineBasicBlock(SwInst.getParent()); - MF->push_back(FalseMBB); + // Insert the comparison blocks one after the other. + MF->insert(std::next(CurMBB.getIterator()), FalseMBB); MIRBuilder.buildBr(*FalseMBB); CurMBB.addSuccessor(FalseMBB); |