[PATCH] PR19958 wrong code at -O1 and above on x86_64-linux-gnu (InstCombine)
Nick Lewycky
nicholas at mxc.ca
Sat Jul 5 19:04:11 PDT 2014
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2349
@@ +2348,3 @@
+ (cast<BinaryOperator>(Op)->isExact())) {
+ if (CI2->getValue().srem(CI->getValue()) == 0) {
+ Quotient = CI2->getValue().sdiv(CI->getValue());
----------------
APInt::isMinValue() is faster than APInt::operator== even though it's less clear to read.
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2350
@@ +2349,3 @@
+ if (CI2->getValue().srem(CI->getValue()) == 0) {
+ Quotient = CI2->getValue().sdiv(CI->getValue());
+ return true;
----------------
APInt::sdivrem is as fast as a single sdiv or srem. Please use it then text the 'rem' results.
================
Comment at: test/Transforms/InstCombine/icmp.ll:1427
@@ -1426,1 +1426,3 @@
}
+
+; CHECK-LABEL: @exact_ashr_eq
----------------
The bugs from last time were due to icmp non-equality comparisons, right? Are those tests already in this code or should you be adding tests to make sure you don't miscompile those cases here?
http://reviews.llvm.org/D4068
More information about the llvm-commits
mailing list