[Mlir-commits] [mlir] 79a0330 - Fix crash from use of a temporary after its scope exit

Mehdi Amini llvmlistbot at llvm.org
Thu Dec 9 21:08:15 PST 2021


Author: Mehdi Amini
Date: 2021-12-10T05:04:23Z
New Revision: 79a0330a525777af58e45836424c62ac67b935e5

URL: https://github.com/llvm/llvm-project/commit/79a0330a525777af58e45836424c62ac67b935e5
DIFF: https://github.com/llvm/llvm-project/commit/79a0330a525777af58e45836424c62ac67b935e5.diff

LOG: Fix crash from use of a temporary after its scope exit

Introduced in D110448 and broke some bots (reported by ASAN).

Differential Revision: https://reviews.llvm.org/D110448

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
index c72d2110a8892..8c269ee8a4dfb 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
@@ -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


        


More information about the Mlir-commits mailing list