[llvm] r358339 - [InstCombine] Remove redundant/bogus mul_with_overflow combines

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 12:43:35 PDT 2019


Author: nikic
Date: Sat Apr 13 12:43:35 2019
New Revision: 358339

URL: http://llvm.org/viewvc/llvm-project?rev=358339&view=rev
Log:
[InstCombine] Remove redundant/bogus mul_with_overflow combines

As pointed out in D60518 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.

Differential Revision: https://reviews.llvm.org/D60649

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=358339&r1=358338&r2=358339&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Sat Apr 13 12:43:35 2019
@@ -4011,14 +4011,6 @@ bool InstCombiner::OptimizeOverflowCheck
 
   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);




More information about the llvm-commits mailing list