[PATCH] D31115: [InstCombine] Provide a way to calculate KnownZero/One for Add/Sub in SimplifyDemandedUseBits without recursing into ComputeKnownBits

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 15:55:45 PDT 2017


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:309
+                                   APInt &KnownZero, APInt &KnownOne,
+                                   APInt &KnownZero2, APInt &KnownOne2,
+                                   unsigned Depth, const Query &Q) {
----------------
Can we call these params RHSKnownZero and RHSKnownOne at this point?


================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:551
 
-    // Otherwise just hand the add/sub off to computeKnownBits to fill in
-    // the known zeros and ones.
-    computeKnownBits(V, KnownZero, KnownOne, Depth, CxtI);
+    // Otherwise commute the known bits using the RHS/LHS known bits.
+    bool NSW = cast<OverflowingBinaryOperator>(I)->hasNoSignedWrap();
----------------
"commute" confused me here. "compute"?
As in:
Compute more known bits based on the existing known bits and the fact that this is an add/sub.


https://reviews.llvm.org/D31115





More information about the llvm-commits mailing list