[PATCH] D97305: [InstSimplify] Handle nsw shl -> poison patterns

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 09:57:00 PST 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Looks good to me.



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1266-1274
+  KnownBits KnownAmt = computeKnownBits(Op1, Q.DL, 0, Q.AC, Q.CxtI, Q.DT);
+  if (KnownAmt.getMinValue().uge(KnownAmt.getBitWidth()))
     return PoisonValue::get(Op0->getType());
 
   // If all valid bits in the shift amount are known zero, the first operand is
   // unchanged.
+  unsigned NumValidShiftBits = Log2_32_Ceil(KnownAmt.getBitWidth());
----------------
NFC, please precommit


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1299
                                  unsigned MaxRecurse) {
-  if (Value *V = SimplifyShift(Opcode, Op0, Op1, Q, MaxRecurse))
+  if (Value *V = SimplifyShift(Opcode, Op0, Op1, false, Q, MaxRecurse))
     return V;
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97305/new/

https://reviews.llvm.org/D97305



More information about the llvm-commits mailing list