[PATCH] D67677: [InstCombine] dropRedundantMaskingOfLeftShiftInput(): pat. a/b with mask (PR42563)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 09:21:04 PDT 2019


lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:176-180
+      Type *ExtendedScalarTy = Type::getIntNTy(Ty->getContext(), 2 * BitWidth);
+      Type *ExtendedTy =
+          Ty->isVectorTy()
+              ? VectorType::get(ExtendedScalarTy, Ty->getVectorNumElements())
+              : ExtendedScalarTy;
----------------
lebedev.ri wrote:
> spatel wrote:
> > Is there a test showing that we need this ext+trunc complexity?
> > 
> > See if I've botched this Alive somehow, but the simpler constant mask appears to work:
> > https://rise4fun.com/Alive/ArQC
> Hmm. The reason i've gone forward with ext/trunc is: https://rise4fun.com/Alive/o5l
> In your example alive does not complain because those are constants, and somehow the usual poison rules don't apply?
> Are we sure this isn't alive limitation, but the correct behavior?
I.e., i don't think i checked, what happens if `ConstantExpr::getShl()` is called with such out-of-bounds shift amount? Does it correctly handle it, or will ubsan complain, etc?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67677





More information about the llvm-commits mailing list