[llvm] [InstCombine] Div ceil optimizations (PR #190175)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 12:23:03 PDT 2026


================
@@ -10361,6 +10361,10 @@ ConstantRange llvm::computeConstantRange(const Value *V, bool ForSigned,
         SI->getFalseValue(), ForSigned, UseInstrInfo, AC, CtxI, DT, Depth + 1);
     CR = CRTrue.unionWith(CRFalse);
     CR = CR.intersectWith(getRangeForSelectPattern(*SI, IIQ));
+  } else if (auto *TI = dyn_cast<TruncInst>(V)) {
+    ConstantRange SrcCR = computeConstantRange(
+        TI->getOperand(0), ForSigned, UseInstrInfo, AC, CtxI, DT, Depth + 1);
+    CR = SrcCR.truncate(BitWidth);
----------------
dtcxzyw wrote:

> Does this really needed by this patch?

I see :)

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


More information about the llvm-commits mailing list