[PATCH] D141031: [InstCombine] Combine (zext a) mul (zext b) to llvm.umul.with.overflow only if mul has NUW flag
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 01:19:22 PST 2023
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LG
================
Comment at: llvm/test/Transforms/InstCombine/overflow-mul.ll:246
+; Negative test: mul(zext x, zext y) may overflow.
+define i32 @mul_may_overflow(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: @mul_may_overflow(
----------------
nit: Drop nounwind.
================
Comment at: llvm/test/Transforms/InstCombine/overflow-mul.ll:280
+ %mul34 = mul i34 %l, %r
+ %overflow = icmp uge i34 4294967295, %mul34
+ %retval = zext i1 %overflow to i32
----------------
This commutation test doesn't look useful, because it will be commuted before the transform.
================
Comment at: llvm/test/Transforms/InstCombine/overflow-mul.ll:283
+ ret i32 %retval
+}
----------------
Add a variant that actually has the nuw flag? (Not just inferred like in above cases.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141031/new/
https://reviews.llvm.org/D141031
More information about the llvm-commits
mailing list