summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCInstrInfo.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-12-11 23:12:25 +0000
committerHal Finkel <hfinkel@anl.gov>2013-12-11 23:12:25 +0000
commit598ee5a3e7fe96cc4b3f92b8c17e393ffcff5293 (patch)
tree4d7f6dad1f68d0fa858b4314950abaf8eaf94711 /lib/Target/PowerPC/PPCInstrInfo.cpp
parent8bacb53cc6925f2af7f0f61f5bd06f34e46fc672 (diff)
downloadllvm-598ee5a3e7fe96cc4b3f92b8c17e393ffcff5293.tar.gz
llvm-598ee5a3e7fe96cc4b3f92b8c17e393ffcff5293.tar.bz2
llvm-598ee5a3e7fe96cc4b3f92b8c17e393ffcff5293.tar.xz
Fix the PPC subsumes-predicate check
For one predicate to subsume another, they must both check the same condition register. Failure to check this prerequisite was causing miscompiles. Fixes PR18003. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r--lib/Target/PowerPC/PPCInstrInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp
index bdeb649d22..c4582c540b 100644
--- a/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -988,6 +988,10 @@ bool PPCInstrInfo::SubsumesPredicate(
if (Pred2[1].getReg() == PPC::CTR8 || Pred2[1].getReg() == PPC::CTR)
return false;
+ // P1 can only subsume P2 if they test the same condition register.
+ if (Pred1[1].getReg() != Pred2[1].getReg())
+ return false;
+
PPC::Predicate P1 = (PPC::Predicate) Pred1[0].getImm();
PPC::Predicate P2 = (PPC::Predicate) Pred2[0].getImm();