diff options
author | Hal Finkel <hfinkel@anl.gov> | 2013-12-11 23:12:25 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2013-12-11 23:12:25 +0000 |
commit | 94a6f380bbbc7e45b554da07f6a5794a2fb2534c (patch) | |
tree | 578241cae4b030383e335d59756e409c9c94b614 /llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | |
parent | 78f4d95d09557e080a02e34fd7c87e96db2afa92 (diff) | |
download | bcm5719-llvm-94a6f380bbbc7e45b554da07f6a5794a2fb2534c.tar.gz bcm5719-llvm-94a6f380bbbc7e45b554da07f6a5794a2fb2534c.zip |
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.
llvm-svn: 197089
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index bdeb649d220..c4582c540ba 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/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(); |