Skip to content

Commit a23a6cc

Browse files
committed
Update base for Update on "[CIR] Add reconcile unrealized casts pass"
[ghstack-poisoned]
1 parent 2d83c0b commit a23a6cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ class CIRLoopOpLowering : public mlir::OpConversionPattern<mlir::cir::LoopOp> {
126126
return mlir::failure();
127127
}
128128
}
129+
130+
// Succeed only if both yields are found.
131+
if (!yieldToBody || !yieldToCont)
132+
return mlir::failure();
129133
return mlir::success();
130134
}
131135

@@ -142,7 +146,7 @@ class CIRLoopOpLowering : public mlir::OpConversionPattern<mlir::cir::LoopOp> {
142146
auto &condFrontBlock = condRegion.front();
143147
mlir::cir::YieldOp yieldToBody, yieldToCont;
144148
if (fetchCondRegionYields(condRegion, yieldToBody, yieldToCont).failed())
145-
loopOp.emitError("invalid yield op kind in cond region");
149+
return loopOp.emitError("failed to fetch yields in cond region");
146150

147151
// Fetch required info from the condition region.
148152
auto &bodyRegion = loopOp.getBody();

0 commit comments

Comments
 (0)