[PATCH] InstCombineCompare with constant return false if we know it is never going to be equal
David Majnemer
david.majnemer at gmail.com
Thu May 22 13:11:30 PDT 2014
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2445
@@ +2444,3 @@
+ const APInt *AP1;
+ if (I.getPredicate() == ICmpInst::ICMP_EQ && match(Op1, m_APInt(AP1)) &&
+ CI->isOne()) {
----------------
What about the `ICmpInst::ICMP_NE` case? We should be able to handle this case just as well.
Can we optimize any of the other predicates?
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2451
@@ +2450,3 @@
+ if (Op0KnownZero.countTrailingOnes() >= 1)
+ return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getType()));
+ }
----------------
If you always transform to true or false, you should probably move this to InstSimplify.
http://reviews.llvm.org/D3868
More information about the llvm-commits
mailing list