[PATCH] D18777: [ValueTracking] An improvement to IR ValueTracking on Non-negative Integers

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 00:19:45 PDT 2016


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Analysis/ValueTracking.cpp:805
@@ +804,3 @@
+// known bits of its first operand.
+static void computeKnownSignBitFromShift(Operator *I, 
+                                         APInt &KnownZero, APInt &KnownOne,
----------------
Can this rule be split out into a separate change of its own (with its own tests etc.)?

================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:1309
@@ -1308,1 +1308,3 @@
+  if ((IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)) ||
+      (isa<ZExtInst>(DU.NarrowUse) && DU.NeverNegative)) { 
     Value *NewDef = DU.WideDef;
----------------
Usually we refrain from changing multiple passes at once.  Can you please move these IndVarSimplify changes to their own patch, with their own tests?

================
Comment at: test/Analysis/ValueTracking/shift-nsw.ll:11
@@ +10,3 @@
+
+for.body.11:                                      ; preds = %for.body.11, %for.preheader
+  %j.0320 = phi i32 [ 0, %for.preheader ], [ %inc, %for.body.11 ]
----------------
- The filename is misleading -- there is a lot going on here other than the "nsw shift" optimization.

- Please break these into small bits of IR functions each of which show one transform.

- Use `CHECK-LABEL`


http://reviews.llvm.org/D18777





More information about the llvm-commits mailing list