[PATCH] D60649: [InstCombine] Remove redundant/bogus mul_with_overflow folds

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 01:35:41 PDT 2019


nikic created this revision.
nikic added reviewers: lebedev.ri, spatel.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

As pointed out in https://reviews.llvm.org/D60518#inline-537280 folding `mulo(%x, undef) to `{undef, undef}` isn't correct. As a correct version of this already exists in InstructionSimplify (https://github.com/llvm-mirror/llvm/blob/bd8056ef326e075cc500f3f0cfcd1193bc200594/lib/Analysis/InstructionSimplify.cpp#L4750-L4757) this is just dead code though. Drop it together with the `mul(%x, 0) -> {0, false}` fold that is also already handled by InstSimplify.


Repository:
  rL LLVM

https://reviews.llvm.org/D60649

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp


Index: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -4011,14 +4011,6 @@
 
   case OCF_UNSIGNED_MUL:
   case OCF_SIGNED_MUL: {
-    // X * undef -> undef
-    if (isa<UndefValue>(RHS))
-      return SetResult(RHS, UndefValue::get(Builder.getInt1Ty()), false);
-
-    // X * 0 -> {0, false}
-    if (match(RHS, m_Zero()))
-      return SetResult(RHS, Builder.getFalse(), false);
-
     // X * 1 -> {X, false}
     if (match(RHS, m_One()))
       return SetResult(LHS, Builder.getFalse(), false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60649.195005.patch
Type: text/x-patch
Size: 696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190413/b6ae13a2/attachment.bin>


More information about the llvm-commits mailing list