Skip to content

Commit f893dcc

Browse files
Replace uses of ConstantExpr::getCompare. (#91558)
Use ICmpInst::compare() where possible, ConstantFoldCompareInstOperands in other places. This only changes places where the either the fold is guaranteed to succeed, or the code doesn't use the resulting compare if we fail to fold.
1 parent 95f208f commit f893dcc

File tree

16 files changed

+76
-69
lines changed

16 files changed

+76
-69
lines changed

llvm/include/llvm/Transforms/Scalar/JumpThreading.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
142142
}
143143

144144
Constant *evaluateOnPredecessorEdge(BasicBlock *BB, BasicBlock *PredPredBB,
145-
Value *cond);
145+
Value *cond, const DataLayout &DL);
146146
bool maybethreadThroughTwoBasicBlocks(BasicBlock *BB, Value *Cond);
147147
void threadThroughTwoBasicBlocks(BasicBlock *PredPredBB, BasicBlock *PredBB,
148148
BasicBlock *BB, BasicBlock *SuccBB);

llvm/lib/Analysis/BranchProbabilityInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ computeUnlikelySuccessors(const BasicBlock *BB, Loop *L,
630630
if (!CmpLHSConst)
631631
continue;
632632
// Now constant-evaluate the compare
633-
Constant *Result = ConstantExpr::getCompare(CI->getPredicate(),
634-
CmpLHSConst, CmpConst, true);
633+
Constant *Result = ConstantFoldCompareInstOperands(
634+
CI->getPredicate(), CmpLHSConst, CmpConst, DL);
635635
// If the result means we don't branch to the block then that block is
636636
// unlikely.
637637
if (Result &&

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,10 +1268,10 @@ Constant *llvm::ConstantFoldCompareInstOperands(
12681268
Value *Stripped1 =
12691269
Ops1->stripAndAccumulateInBoundsConstantOffsets(DL, Offset1);
12701270
if (Stripped0 == Stripped1)
1271-
return ConstantExpr::getCompare(
1272-
ICmpInst::getSignedPredicate(Predicate),
1273-
ConstantInt::get(CE0->getContext(), Offset0),
1274-
ConstantInt::get(CE0->getContext(), Offset1));
1271+
return ConstantInt::getBool(
1272+
Ops0->getContext(),
1273+
ICmpInst::compare(Offset0, Offset1,
1274+
ICmpInst::getSignedPredicate(Predicate)));
12751275
}
12761276
} else if (isa<ConstantExpr>(Ops1)) {
12771277
// If RHS is a constant expression, but the left side isn't, swap the

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,13 +2046,11 @@ bool CallAnalyzer::visitCmpInst(CmpInst &I) {
20462046
if (RHSBase && LHSBase == RHSBase) {
20472047
// We have common bases, fold the icmp to a constant based on the
20482048
// offsets.
2049-
Constant *CLHS = ConstantInt::get(LHS->getContext(), LHSOffset);
2050-
Constant *CRHS = ConstantInt::get(RHS->getContext(), RHSOffset);
2051-
if (Constant *C = ConstantExpr::getICmp(I.getPredicate(), CLHS, CRHS)) {
2052-
SimplifiedValues[&I] = C;
2053-
++NumConstantPtrCmps;
2054-
return true;
2055-
}
2049+
SimplifiedValues[&I] = ConstantInt::getBool(
2050+
I.getType(),
2051+
ICmpInst::compare(LHSOffset, RHSOffset, I.getPredicate()));
2052+
++NumConstantPtrCmps;
2053+
return true;
20562054
}
20572055
}
20582056

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10615,9 +10615,7 @@ bool ScalarEvolution::SimplifyICmpOperands(ICmpInst::Predicate &Pred,
1061510615
if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) {
1061610616
// Check for both operands constant.
1061710617
if (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(RHS)) {
10618-
if (ConstantExpr::getICmp(Pred,
10619-
LHSC->getValue(),
10620-
RHSC->getValue())->isNullValue())
10618+
if (!ICmpInst::compare(LHSC->getAPInt(), RHSC->getAPInt(), Pred))
1062110619
return TrivialCase(false);
1062210620
return TrivialCase(true);
1062310621
}

llvm/lib/IR/Constants.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ bool Constant::isElementWiseEqual(Value *Y) const {
315315
Type *IntTy = VectorType::getInteger(VTy);
316316
Constant *C0 = ConstantExpr::getBitCast(const_cast<Constant *>(this), IntTy);
317317
Constant *C1 = ConstantExpr::getBitCast(cast<Constant>(Y), IntTy);
318-
Constant *CmpEq = ConstantExpr::getICmp(ICmpInst::ICMP_EQ, C0, C1);
319-
return isa<PoisonValue>(CmpEq) || match(CmpEq, m_One());
318+
Constant *CmpEq = ConstantFoldCompareInstruction(ICmpInst::ICMP_EQ, C0, C1);
319+
return CmpEq && (isa<PoisonValue>(CmpEq) || match(CmpEq, m_One()));
320320
}
321321

322322
static bool

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,9 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
854854

855855
if (auto *CSrc0 = dyn_cast<Constant>(Src0)) {
856856
if (auto *CSrc1 = dyn_cast<Constant>(Src1)) {
857-
Constant *CCmp = ConstantExpr::getCompare(CCVal, CSrc0, CSrc1);
858-
if (CCmp->isNullValue()) {
857+
Constant *CCmp = ConstantFoldCompareInstOperands(
858+
(ICmpInst::Predicate)CCVal, CSrc0, CSrc1, DL);
859+
if (CCmp && CCmp->isNullValue()) {
859860
return IC.replaceInstUsesWith(
860861
II, IC.Builder.CreateSExt(CCmp, II.getType()));
861862
}

llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,21 @@ using namespace llvm;
2626

2727
/// Return a constant boolean vector that has true elements in all positions
2828
/// where the input constant data vector has an element with the sign bit set.
29-
static Constant *getNegativeIsTrueBoolVec(Constant *V) {
29+
static Constant *getNegativeIsTrueBoolVec(Constant *V, const DataLayout &DL) {
3030
VectorType *IntTy = VectorType::getInteger(cast<VectorType>(V->getType()));
3131
V = ConstantExpr::getBitCast(V, IntTy);
32-
V = ConstantExpr::getICmp(CmpInst::ICMP_SGT, Constant::getNullValue(IntTy),
33-
V);
32+
V = ConstantFoldCompareInstOperands(CmpInst::ICMP_SGT,
33+
Constant::getNullValue(IntTy), V, DL);
34+
assert(V && "Vector must be foldable");
3435
return V;
3536
}
3637

3738
/// Convert the x86 XMM integer vector mask to a vector of bools based on
3839
/// each element's most significant bit (the sign bit).
39-
static Value *getBoolVecFromMask(Value *Mask) {
40+
static Value *getBoolVecFromMask(Value *Mask, const DataLayout &DL) {
4041
// Fold Constant Mask.
4142
if (auto *ConstantMask = dyn_cast<ConstantDataVector>(Mask))
42-
return getNegativeIsTrueBoolVec(ConstantMask);
43+
return getNegativeIsTrueBoolVec(ConstantMask, DL);
4344

4445
// Mask was extended from a boolean vector.
4546
Value *ExtMask;
@@ -65,7 +66,7 @@ static Instruction *simplifyX86MaskedLoad(IntrinsicInst &II, InstCombiner &IC) {
6566

6667
// The mask is constant or extended from a bool vector. Convert this x86
6768
// intrinsic to the LLVM intrinsic to allow target-independent optimizations.
68-
if (Value *BoolMask = getBoolVecFromMask(Mask)) {
69+
if (Value *BoolMask = getBoolVecFromMask(Mask, IC.getDataLayout())) {
6970
// First, cast the x86 intrinsic scalar pointer to a vector pointer to match
7071
// the LLVM intrinsic definition for the pointer argument.
7172
unsigned AddrSpace = cast<PointerType>(Ptr->getType())->getAddressSpace();
@@ -102,7 +103,7 @@ static bool simplifyX86MaskedStore(IntrinsicInst &II, InstCombiner &IC) {
102103

103104
// The mask is constant or extended from a bool vector. Convert this x86
104105
// intrinsic to the LLVM intrinsic to allow target-independent optimizations.
105-
if (Value *BoolMask = getBoolVecFromMask(Mask)) {
106+
if (Value *BoolMask = getBoolVecFromMask(Mask, IC.getDataLayout())) {
106107
unsigned AddrSpace = cast<PointerType>(Ptr->getType())->getAddressSpace();
107108
PointerType *VecPtrTy = PointerType::get(Vec->getType(), AddrSpace);
108109
Value *PtrCast = IC.Builder.CreateBitCast(Ptr, VecPtrTy, "castvec");
@@ -2688,7 +2689,8 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
26882689

26892690
// Constant Mask - select 1st/2nd argument lane based on top bit of mask.
26902691
if (auto *ConstantMask = dyn_cast<ConstantDataVector>(Mask)) {
2691-
Constant *NewSelector = getNegativeIsTrueBoolVec(ConstantMask);
2692+
Constant *NewSelector =
2693+
getNegativeIsTrueBoolVec(ConstantMask, IC.getDataLayout());
26922694
return SelectInst::Create(NewSelector, Op1, Op0, "blendv");
26932695
}
26942696

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,8 +2504,8 @@ Instruction *InstCombinerImpl::visitAnd(BinaryOperator &I) {
25042504
match(C1, m_Power2())) {
25052505
Constant *Log2C1 = ConstantExpr::getExactLogBase2(C1);
25062506
Constant *Cmp =
2507-
ConstantExpr::getCompare(ICmpInst::ICMP_ULT, Log2C3, C2);
2508-
if (Cmp->isZeroValue()) {
2507+
ConstantFoldCompareInstOperands(ICmpInst::ICMP_ULT, Log2C3, C2, DL);
2508+
if (Cmp && Cmp->isZeroValue()) {
25092509
// iff C1,C3 is pow2 and Log2(C3) >= C2:
25102510
// ((C1 >> X) << C2) & C3 -> X == (cttz(C1)+C2-cttz(C3)) ? C3 : 0
25112511
Constant *ShlC = ConstantExpr::getAdd(C2, Log2C1);

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
19821982
if (ModuloC != ShAmtC)
19831983
return replaceOperand(*II, 2, ModuloC);
19841984

1985-
assert(match(ConstantExpr::getICmp(ICmpInst::ICMP_UGT, WidthC, ShAmtC),
1985+
assert(match(ConstantFoldCompareInstOperands(ICmpInst::ICMP_UGT, WidthC,
1986+
ShAmtC, DL),
19861987
m_One()) &&
19871988
"Shift amount expected to be modulo bitwidth");
19881989

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,15 +3176,12 @@ Instruction *InstCombinerImpl::foldICmpSelectConstant(ICmpInst &Cmp,
31763176
C3GreaterThan)) {
31773177
assert(C1LessThan && C2Equal && C3GreaterThan);
31783178

3179-
bool TrueWhenLessThan =
3180-
ConstantExpr::getCompare(Cmp.getPredicate(), C1LessThan, C)
3181-
->isAllOnesValue();
3182-
bool TrueWhenEqual =
3183-
ConstantExpr::getCompare(Cmp.getPredicate(), C2Equal, C)
3184-
->isAllOnesValue();
3185-
bool TrueWhenGreaterThan =
3186-
ConstantExpr::getCompare(Cmp.getPredicate(), C3GreaterThan, C)
3187-
->isAllOnesValue();
3179+
bool TrueWhenLessThan = ICmpInst::compare(
3180+
C1LessThan->getValue(), C->getValue(), Cmp.getPredicate());
3181+
bool TrueWhenEqual = ICmpInst::compare(C2Equal->getValue(), C->getValue(),
3182+
Cmp.getPredicate());
3183+
bool TrueWhenGreaterThan = ICmpInst::compare(
3184+
C3GreaterThan->getValue(), C->getValue(), Cmp.getPredicate());
31883185

31893186
// This generates the new instruction that will replace the original Cmp
31903187
// Instruction. Instead of enumerating the various combinations when

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,8 @@ Instruction *InstCombinerImpl::foldSelectValueEquivalence(SelectInst &Sel,
13651365
// Also ULT predicate can also be UGT iff C0 != -1 (+invert result)
13661366
// SLT predicate can also be SGT iff C2 != INT_MAX (+invert res.)
13671367
static Value *canonicalizeClampLike(SelectInst &Sel0, ICmpInst &Cmp0,
1368-
InstCombiner::BuilderTy &Builder) {
1368+
InstCombiner::BuilderTy &Builder,
1369+
InstCombiner &IC) {
13691370
Value *X = Sel0.getTrueValue();
13701371
Value *Sel1 = Sel0.getFalseValue();
13711372

@@ -1493,14 +1494,14 @@ static Value *canonicalizeClampLike(SelectInst &Sel0, ICmpInst &Cmp0,
14931494
std::swap(ThresholdLowIncl, ThresholdHighExcl);
14941495

14951496
// The fold has a precondition 1: C2 s>= ThresholdLow
1496-
auto *Precond1 = ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_SGE, C2,
1497-
ThresholdLowIncl);
1498-
if (!match(Precond1, m_One()))
1497+
auto *Precond1 = ConstantFoldCompareInstOperands(
1498+
ICmpInst::Predicate::ICMP_SGE, C2, ThresholdLowIncl, IC.getDataLayout());
1499+
if (!Precond1 || !match(Precond1, m_One()))
14991500
return nullptr;
15001501
// The fold has a precondition 2: C2 s<= ThresholdHigh
1501-
auto *Precond2 = ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_SLE, C2,
1502-
ThresholdHighExcl);
1503-
if (!match(Precond2, m_One()))
1502+
auto *Precond2 = ConstantFoldCompareInstOperands(
1503+
ICmpInst::Predicate::ICMP_SLE, C2, ThresholdHighExcl, IC.getDataLayout());
1504+
if (!Precond2 || !match(Precond2, m_One()))
15041505
return nullptr;
15051506

15061507
// If we are matching from a truncated input, we need to sext the
@@ -1803,7 +1804,7 @@ Instruction *InstCombinerImpl::foldSelectInstWithICmp(SelectInst &SI,
18031804
if (Value *V = foldSelectInstWithICmpConst(SI, ICI, Builder))
18041805
return replaceInstUsesWith(SI, V);
18051806

1806-
if (Value *V = canonicalizeClampLike(SI, *ICI, Builder))
1807+
if (Value *V = canonicalizeClampLike(SI, *ICI, Builder, *this))
18071808
return replaceInstUsesWith(SI, V);
18081809

18091810
if (Instruction *NewSel =

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,12 @@ Instruction *InstCombinerImpl::tryFoldInstWithCtpopWithNot(Instruction *I) {
808808
Constant *BitWidthC = ConstantInt::get(Ty, Ty->getScalarSizeInBits());
809809
// Need extra check for icmp. Note if this check is true, it generally means
810810
// the icmp will simplify to true/false.
811-
if (Opc == Instruction::ICmp && !cast<ICmpInst>(I)->isEquality() &&
812-
!ConstantExpr::getICmp(ICmpInst::ICMP_UGT, C, BitWidthC)->isZeroValue())
813-
return nullptr;
811+
if (Opc == Instruction::ICmp && !cast<ICmpInst>(I)->isEquality()) {
812+
Constant *Cmp =
813+
ConstantFoldCompareInstOperands(ICmpInst::ICMP_UGT, C, BitWidthC, DL);
814+
if (!Cmp || !Cmp->isZeroValue())
815+
return nullptr;
816+
}
814817

815818
// Check we can invert `(not x)` for free.
816819
bool Consumes = false;

llvm/lib/Transforms/Scalar/JumpThreading.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,8 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
868868

869869
for (const auto &LHSVal : LHSVals) {
870870
Constant *V = LHSVal.first;
871-
Constant *Folded = ConstantExpr::getCompare(Pred, V, CmpConst);
871+
Constant *Folded =
872+
ConstantFoldCompareInstOperands(Pred, V, CmpConst, DL);
872873
if (Constant *KC = getKnownConstant(Folded, WantInteger))
873874
Result.emplace_back(KC, LHSVal.second);
874875
}
@@ -1509,7 +1510,8 @@ findMostPopularDest(BasicBlock *BB,
15091510
// BB->getSinglePredecessor() and then on to BB.
15101511
Constant *JumpThreadingPass::evaluateOnPredecessorEdge(BasicBlock *BB,
15111512
BasicBlock *PredPredBB,
1512-
Value *V) {
1513+
Value *V,
1514+
const DataLayout &DL) {
15131515
BasicBlock *PredBB = BB->getSinglePredecessor();
15141516
assert(PredBB && "Expected a single predecessor");
15151517

@@ -1534,11 +1536,12 @@ Constant *JumpThreadingPass::evaluateOnPredecessorEdge(BasicBlock *BB,
15341536
if (CmpInst *CondCmp = dyn_cast<CmpInst>(V)) {
15351537
if (CondCmp->getParent() == BB) {
15361538
Constant *Op0 =
1537-
evaluateOnPredecessorEdge(BB, PredPredBB, CondCmp->getOperand(0));
1539+
evaluateOnPredecessorEdge(BB, PredPredBB, CondCmp->getOperand(0), DL);
15381540
Constant *Op1 =
1539-
evaluateOnPredecessorEdge(BB, PredPredBB, CondCmp->getOperand(1));
1541+
evaluateOnPredecessorEdge(BB, PredPredBB, CondCmp->getOperand(1), DL);
15401542
if (Op0 && Op1) {
1541-
return ConstantExpr::getCompare(CondCmp->getPredicate(), Op0, Op1);
1543+
return ConstantFoldCompareInstOperands(CondCmp->getPredicate(), Op0,
1544+
Op1, DL);
15421545
}
15431546
}
15441547
return nullptr;
@@ -2191,12 +2194,13 @@ bool JumpThreadingPass::maybethreadThroughTwoBasicBlocks(BasicBlock *BB,
21912194
unsigned OneCount = 0;
21922195
BasicBlock *ZeroPred = nullptr;
21932196
BasicBlock *OnePred = nullptr;
2197+
const DataLayout &DL = BB->getModule()->getDataLayout();
21942198
for (BasicBlock *P : predecessors(PredBB)) {
21952199
// If PredPred ends with IndirectBrInst, we can't handle it.
21962200
if (isa<IndirectBrInst>(P->getTerminator()))
21972201
continue;
21982202
if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(
2199-
evaluateOnPredecessorEdge(BB, P, Cond))) {
2203+
evaluateOnPredecessorEdge(BB, P, Cond, DL))) {
22002204
if (CI->isZero()) {
22012205
ZeroCount++;
22022206
ZeroPred = P;

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6580,16 +6580,17 @@ static void reuseTableCompare(
65806580
Constant *FalseConst = ConstantInt::getFalse(RangeCmp->getType());
65816581

65826582
// Check if the compare with the default value is constant true or false.
6583-
Constant *DefaultConst = ConstantExpr::getICmp(CmpInst->getPredicate(),
6584-
DefaultValue, CmpOp1, true);
6583+
const DataLayout &DL = PhiBlock->getModule()->getDataLayout();
6584+
Constant *DefaultConst = ConstantFoldCompareInstOperands(
6585+
CmpInst->getPredicate(), DefaultValue, CmpOp1, DL);
65856586
if (DefaultConst != TrueConst && DefaultConst != FalseConst)
65866587
return;
65876588

65886589
// Check if the compare with the case values is distinct from the default
65896590
// compare result.
65906591
for (auto ValuePair : Values) {
6591-
Constant *CaseConst = ConstantExpr::getICmp(CmpInst->getPredicate(),
6592-
ValuePair.second, CmpOp1, true);
6592+
Constant *CaseConst = ConstantFoldCompareInstOperands(
6593+
CmpInst->getPredicate(), ValuePair.second, CmpOp1, DL);
65936594
if (!CaseConst || CaseConst == DefaultConst ||
65946595
(CaseConst != TrueConst && CaseConst != FalseConst))
65956596
return;

llvm/test/Transforms/JumpThreading/thread-two-bbs.ll

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ exit:
130130
}
131131

132132

133-
; Verify that we do *not* thread any edge. We used to evaluate
134-
; constant expressions like:
133+
; Verify that we thread the edge correctly. We used to evaluate constant
134+
; expressions like:
135135
;
136136
; icmp ugt ptr null, inttoptr (i64 4 to ptr)
137137
;
@@ -141,16 +141,17 @@ define void @icmp_ult_null_constexpr(ptr %arg1, ptr %arg2) {
141141
; CHECK-LABEL: @icmp_ult_null_constexpr(
142142
; CHECK-NEXT: entry:
143143
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[ARG1:%.*]], null
144-
; CHECK-NEXT: br i1 [[CMP1]], label [[BB_BAR1:%.*]], label [[BB_END:%.*]]
145-
; CHECK: bb_bar1:
146-
; CHECK-NEXT: call void @bar(i32 1)
147-
; CHECK-NEXT: br label [[BB_END]]
144+
; CHECK-NEXT: br i1 [[CMP1]], label [[BB_END_THREAD:%.*]], label [[BB_END:%.*]]
148145
; CHECK: bb_end:
149146
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne ptr [[ARG2:%.*]], null
150147
; CHECK-NEXT: br i1 [[CMP2]], label [[BB_CONT:%.*]], label [[BB_BAR2:%.*]]
148+
; CHECK: bb_end.thread:
149+
; CHECK-NEXT: call void @bar(i32 1)
150+
; CHECK-NEXT: [[CMP21:%.*]] = icmp ne ptr [[ARG2]], null
151+
; CHECK-NEXT: br i1 [[CMP21]], label [[BB_EXIT:%.*]], label [[BB_BAR2]]
151152
; CHECK: bb_bar2:
152153
; CHECK-NEXT: call void @bar(i32 2)
153-
; CHECK-NEXT: br label [[BB_EXIT:%.*]]
154+
; CHECK-NEXT: br label [[BB_EXIT]]
154155
; CHECK: bb_cont:
155156
; CHECK-NEXT: [[CMP3:%.*]] = icmp ult ptr [[ARG1]], inttoptr (i64 4 to ptr)
156157
; CHECK-NEXT: br i1 [[CMP3]], label [[BB_EXIT]], label [[BB_BAR3:%.*]]

0 commit comments

Comments
 (0)