[PATCH] D68239: [InstCombine] dropRedundantMaskingOfLeftShiftInput(): propagate undef shift amounts

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 5 11:04:21 PDT 2019


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:190-192
+      // If any of these shift amounts are undef, *ext will turn them into
+      // zeros, let's keep undef's by replacing them with some illegal shift
+      // amount.
----------------
lebedev.ri wrote:
> spatel wrote:
> > Probably worth explaining this more directly, and what if we make it consistent by replacing with -1?
> >   // An extend of an undef value becomes zero because the 
> >   // high bits are never completely unknown. Replace the
> >   // the shift amount with -1 to ensure that the value remains
> >   // undef when creating the subsequent shift op.
> Good comments are always good :)
> Not with -1 though.
Why is using different variants based on bidwidth better? Or does -1 not work as a poisonous shift amount?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68239





More information about the llvm-commits mailing list