summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
diff options
context:
space:
mode:
authorWei Mi <wmi@google.com>2019-01-02 17:07:23 +0000
committerWei Mi <wmi@google.com>2019-01-02 17:07:23 +0000
commitecc89b76cb8f3a9732bebb1a094b840bdb4c2302 (patch)
tree99605df23768a29647dcc69f9daf7f4b7768de1f /llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
parentd8125726d5b53e546944dd84d0efa258257f18a1 (diff)
downloadbcm5719-llvm-ecc89b76cb8f3a9732bebb1a094b840bdb4c2302.tar.gz
bcm5719-llvm-ecc89b76cb8f3a9732bebb1a094b840bdb4c2302.zip
[PowerPC] Remove SeenUse check when optimizing conditional branch in
PPCPreEmitPeephole pass. PPCPreEmitPeephole will convert a BC to B when the conditional branch is based on a constant CR by CRSET or CRUNSET. This is added in https://reviews.llvm.org/rL343100. When the conditional branch is known to be always taken, all branches will be removed and a new unconditional branch will be inserted. However, when SeenUse is false the original patch will not remove the branches, but still insert the new unconditional branch, update the successors and create inconsistent IR. Compiling the synthetic testcase included can show the problem we run into. The patch simply removes the SeenUse condition when adding branches into InstrsToErase set. Differential Revision: https://reviews.llvm.org/D56041 llvm-svn: 350223
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp b/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
index 3078a6610fe..4458b92ceb5 100644
--- a/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
+++ b/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
@@ -140,7 +140,7 @@ namespace {
// This conditional branch is always taken. So, remove all branches
// and insert an unconditional branch to the destination of this.
MachineBasicBlock::iterator It = Br, Er = MBB.end();
- for (; It != Er && !SeenUse; It++) {
+ for (; It != Er; It++) {
if (It->isDebugInstr()) continue;
assert(It->isTerminator() && "Non-terminator after a terminator");
InstrsToErase.push_back(&*It);
OpenPOWER on IntegriCloud