summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC
diff options
context:
space:
mode:
authorYi-Hong Lyu <Yi-Hong.Lyu@ibm.com>2019-11-11 16:15:52 +0000
committerYi-Hong Lyu <Yi-Hong.Lyu@ibm.com>2019-11-11 17:28:50 +0000
commit6bbfafd03782a4bf9522edeaf4860470946ecfd0 (patch)
tree3e6e1daa36ed3cead1ba7169f728d2b0c487eca1 /llvm/lib/Target/PowerPC
parent4162875c3b2a2326c8f40b6cba98308d819f4d49 (diff)
downloadbcm5719-llvm-6bbfafd03782a4bf9522edeaf4860470946ecfd0.tar.gz
bcm5719-llvm-6bbfafd03782a4bf9522edeaf4860470946ecfd0.zip
[CGP] Make ICMP_EQ use CR result of ICMP_S(L|G)T dominators
For example: long long test(long long a, long long b) { if (a << b > 0) return b; if (a << b < 0) return a; return a*b; } Produces: sld. 5, 3, 4 ble 0, .LBB0_2 mr 3, 4 blr .LBB0_2: # %if.end cmpldi 5, 0 li 5, 1 isel 4, 4, 5, 2 mulld 3, 4, 3 blr But the compare (cmpldi 5, 0) is redundant and can be removed (CR0 already contains the result of that comparison). The root cause of this is that LLVM converts signed comparisons into equality comparison based on dominance. Equality comparisons are unsigned by default, so we get either a record-form or cmp (without the l for logical) feeding a cmpl. That is the situation we want to avoid here. Differential Revision: https://reviews.llvm.org/D60506
Diffstat (limited to 'llvm/lib/Target/PowerPC')
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h
index 7016a601490..a01134321b9 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.h
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h
@@ -650,6 +650,10 @@ namespace llvm {
return true;
}
+ bool isEqualityCmpFoldedWithSignedCmp() const override {
+ return false;
+ }
+
bool hasAndNotCompare(SDValue) const override {
return true;
}
OpenPOWER on IntegriCloud