[llvm] [InstCombine] Infer exact for lshr by cttz (PR #136696)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 07:55:34 PDT 2025


================
@@ -994,6 +994,18 @@ static bool setShiftFlags(BinaryOperator &I, const SimplifyQuery &Q) {
       I.setIsExact();
       return true;
     }
+    //Fix #131444
+    if (auto *Cttz = dyn_cast<IntrinsicInst>(I.getOperand(1))) {
+      if (Cttz->getIntrinsicID() == Intrinsic::cttz &&
+          Cttz->getOperand(0) == I.getOperand(0)) {
----------------
nikic wrote:

You can use the `m_Intrinsic` matcher.

https://github.com/llvm/llvm-project/pull/136696


More information about the llvm-commits mailing list