Skip to content

Commit

Permalink
Fix crash from use of a temporary after its scope exit
Browse files Browse the repository at this point in the history
Introduced in D110448 and broke some bots (reported by ASAN).

Differential Revision: https://reviews.llvm.org/D110448
  • Loading branch information
joker-eph committed Dec 10, 2021
1 parent f829630 commit 79a0330
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,10 @@ LogicalResult GPUPrintfOpToHIPLowering::matchAndRewrite(
Value zeroI32 = rewriter.create<LLVM::ConstantOp>(
loc, llvmI32, rewriter.getI32IntegerAttr(0));

mlir::ValueRange appendFormatArgs = {printfDesc, stringStart, stringLen,
adaptor.args().empty() ? oneI32
: zeroI32};
auto appendFormatCall =
rewriter.create<LLVM::CallOp>(loc, ocklAppendStringN, appendFormatArgs);
auto appendFormatCall = rewriter.create<LLVM::CallOp>(
loc, ocklAppendStringN,
ValueRange{printfDesc, stringStart, stringLen,
adaptor.args().empty() ? oneI32 : zeroI32});
printfDesc = appendFormatCall.getResult(0);

// __ockl_printf_append_args takes 7 values per append call
Expand Down

0 comments on commit 79a0330

Please sign in to comment.