[PATCH] D21493: [ValueTracking] Teach computeKnownBits for PHI nodes to compute sign bit for a recurrence with a NSW addition.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 12:23:07 PDT 2016


craig.topper added inline comments.

================
Comment at: lib/Analysis/ValueTracking.cpp:1251
@@ +1250,3 @@
+              KnownZero.setBit(BitWidth-1);
+            if (KnownOne2.isNegative() && KnownOne3.isNegative())
+              KnownOne.setBit(BitWidth-1);
----------------
sanjoy wrote:
> Can you please add a test for this second bit (i.e. negative stays negative)?
Do you have a suggestion for how to test that? I knew of the sign bit being 0 check in instcombine of sdiv so I used that for the 0 case. But I don't know enough about what optimizations can benefit from knowing the sign bit is set.


http://reviews.llvm.org/D21493





More information about the llvm-commits mailing list