Skip to content

Commit 9063022

Browse files
committed
[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.
1 parent 6c85e92 commit 9063022

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,10 +2742,11 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
27422742
Pred == CmpInst::ICMP_NE) {
27432743
Value *A, *B;
27442744
if (match(UMulWithOv, m_Intrinsic<Intrinsic::umul_with_overflow>(
2745-
m_Value(A), m_Value(B))))
2746-
2747-
return BinaryOperator::CreateAnd(Builder.CreateIsNotNull(A),
2748-
Builder.CreateIsNotNull(B));
2745+
m_Value(A), m_Value(B)))) {
2746+
Value *NotNullA = Builder.CreateIsNotNull(A);
2747+
Value *NotNullB = Builder.CreateIsNotNull(B);
2748+
return BinaryOperator::CreateAnd(NotNullA, NotNullB);
2749+
}
27492750
}
27502751

27512752
return nullptr;

0 commit comments

Comments
 (0)