[PATCH] D66383: [InstCombine] Shift amount reassociation in bittest: trunc-of-lshr (PR42399)

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 06:54:08 PDT 2019


xbolva00 added a comment.

Does this show up in bootstrap/test suite?

Rare folds with big pattern matching should go to AgressiveInstCombine.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3383
+             m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT,
+                                APInt(WidestTy->getScalarSizeInBits(),
+                                      WidestTy->getScalarSizeInBits()))))
----------------
Use ´WidestBitWidth´


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3396
+      };
+      unsigned WidestBitWidth = WidestTy->getScalarSizeInBits();
+
----------------
Hoist it


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3432
+      if (auto C = dyn_cast<Constant>(WidestShift->getOperand(0))) {
+        // Precondition:  (63-NewShAmt) u<= countLeadingZeros(C)
+        KnownBits K = computeKnownBits(C, SQ.DL);
----------------
Replace 63 with WidestBitWidth - 1?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66383





More information about the llvm-commits mailing list