Skip to content

Commit 28a5f7e

Browse files
committed
Update LowerFunction.cpp
1 parent 1e4f5d9 commit 28a5f7e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerFunction.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,10 @@ mlir::Value createCoercedValue(mlir::Value Src, mlir::Type Ty,
336336
return CGF.buildAggregateBitcast(Src, Ty);
337337
}
338338

339-
Src = findAlloca(Src.getDefiningOp());
340-
if (Src) {
341-
auto tmpAlloca = createTmpAlloca(CGF, Src.getLoc(), Ty);
342-
createMemCpy(CGF, tmpAlloca, Src, SrcSize.getFixedValue());
343-
return CGF.getRewriter().create<LoadOp>(Src.getLoc(),
339+
if (auto alloca = findAlloca(Src.getDefiningOp()) {
340+
auto tmpAlloca = createTmpAlloca(CGF, alloca.getLoc(), Ty);
341+
createMemCpy(CGF, tmpAlloca, alloca, SrcSize.getFixedValue());
342+
return CGF.getRewriter().create<LoadOp>(alloca.getLoc(),
344343
tmpAlloca.getResult());
345344
}
346345

0 commit comments

Comments
 (0)