[PATCH] D23468: [ValueTracking] Sign bit of shl cannot be both known one and known zero. Fix PR28926

Li Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:30:54 PDT 2016


lihuang added inline comments.

================
Comment at: lib/Analysis/ValueTracking.cpp:842-850
@@ -844,11 +841,11 @@
 
   // If there are no compatible shift amounts, then we've proven that the shift
   // amount must be >= the BitWidth, and the result is undefined. We could
   // return anything we'd like, but we need to make sure the sets of known bits
   // stay disjoint (it should be better for some other code to actually
   // propagate the undef than to pick a value here using known bits).
   if ((KnownZero & KnownOne) != 0) {
     KnownZero.clearAllBits();
     KnownOne.clearAllBits();
   }
 }
----------------
majnemer wrote:
> Shouldn't we just add this logic to the ConstantInt branch above, right before the return?
> Then we could teach InstSimplify to xform this into the non-undef arm of the select.
Thank you for the advice David. We could do this, but I think I still need to fix the logic in the SHL case of computeKnownBitsFromOperator as that's the root cause.


https://reviews.llvm.org/D23468





More information about the llvm-commits mailing list