[PATCH] D14392: [ValueTracking] Teach isImpliedCondition a new bitwise trick
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 6 16:37:22 PST 2015
reames added inline comments.
================
Comment at: lib/Analysis/ValueTracking.cpp:4123
@@ +4122,3 @@
+
+ // If the low K bits of X are known to be zero, and both C0 and C1
+ // fit in K bits, then
----------------
A cleaner way of framing this content is simply to state that X | C where X low bits are zero is equivalent to X+C.
================
Comment at: lib/Analysis/ValueTracking.cpp:4136
@@ +4135,3 @@
+ ConstantInt *CI0, *CI1;
+ if (match(LHS, m_Or(m_Value(X), m_ConstantInt(CI0))) &&
+ match(RHS, m_Or(m_Specific(X), m_ConstantInt(CI1)))) {
----------------
Hm, might it be cleaner to introduce a matcher which matches both adds and adds implemented via OR? Doing so would simplify this code, but might involve recomputing known bits twice. Not sure if this is actually a good idea or not.
================
Comment at: lib/Analysis/ValueTracking.cpp:4143
@@ +4142,3 @@
+ unsigned LowZeroes = KnownZero.countTrailingOnes();
+ APInt UpperLimit =
+ APInt::getBitsSet(KnownZero.getBitWidth(), LowZeroes, LowZeroes + 1);
----------------
This is equivalent to 1 << LowZeroes right?
Might be clearer as uge(MaskOfOnesForLowZeros).
http://reviews.llvm.org/D14392
More information about the llvm-commits
mailing list