[llvm] 9063022 - [InstCombin] Avoid nested Create calls, to guarantee order.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 00:46:24 PST 2020


Author: Florian Hahn
Date: 2020-02-18T09:44:11+01:00
New Revision: 90630225730524ee7982e1475f5af9683450d4e7

URL: https://github.com/llvm/llvm-project/commit/90630225730524ee7982e1475f5af9683450d4e7
DIFF: https://github.com/llvm/llvm-project/commit/90630225730524ee7982e1475f5af9683450d4e7.diff

LOG: [InstCombin] Avoid nested Create calls, to guarantee order.

The original code allowed creating the != checks in unpredictable order,
causing http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/34014
to fail.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 677b56daa598..06ec02789750 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -2742,10 +2742,11 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
       Pred == CmpInst::ICMP_NE) {
     Value *A, *B;
     if (match(UMulWithOv, m_Intrinsic<Intrinsic::umul_with_overflow>(
-                              m_Value(A), m_Value(B))))
-
-      return BinaryOperator::CreateAnd(Builder.CreateIsNotNull(A),
-                                       Builder.CreateIsNotNull(B));
+                              m_Value(A), m_Value(B)))) {
+      Value *NotNullA = Builder.CreateIsNotNull(A);
+      Value *NotNullB = Builder.CreateIsNotNull(B);
+      return BinaryOperator::CreateAnd(NotNullA, NotNullB);
+    }
   }
 
   return nullptr;


        


More information about the llvm-commits mailing list