[llvm] [InstCombine] Fold trunc(umin/umax(zext(x), y & mask)) to narrower umin/umax (PR #173221)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 21 23:53:13 PST 2025


================
@@ -489,10 +521,21 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
   auto *I = cast<Instruction>(V);
   Type *OrigTy = V->getType();
   switch (I->getOpcode()) {
+  case Instruction::And: {
+    // And can be truncated if all the truncated bits are zero.
+    uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
----------------
topperc wrote:

Use `unsigned` to match the declared type of `getScalarSizeInBits`

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


More information about the llvm-commits mailing list