[llvm] [SPIR-V]: Memory leak fix in SPIRVEmitIntrinsics (PR #83015)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 03:57:56 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 94a0dd5a1960e1ace0a161228f91c2e18865d061 40ff1a741b0984606fed6536815b49b12f2bbcbb -- llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
index dfdfae551d..5c432d6827 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
@@ -252,7 +252,7 @@ Instruction *SPIRVEmitIntrinsics::visitSwitchInst(SwitchInst &I) {
Args.push_back(Op);
B.SetInsertPoint(&I);
B.CreateIntrinsic(Intrinsic::spv_switch, {I.getOperand(0)->getType()},
- {Args});
+ {Args});
return &I;
}
@@ -540,8 +540,8 @@ Instruction *SPIRVEmitIntrinsics::visitLoadInst(LoadInst &I) {
TLI->getLoadMemOperandFlags(I, F->getParent()->getDataLayout());
auto *NewI =
B.CreateIntrinsic(Intrinsic::spv_load, {I.getOperand(0)->getType()},
- {I.getPointerOperand(), B.getInt16(Flags),
- B.getInt8(I.getAlign().value())});
+ {I.getPointerOperand(), B.getInt16(Flags),
+ B.getInt8(I.getAlign().value())});
replaceMemInstrUses(&I, NewI, B);
return NewI;
}
@@ -581,10 +581,9 @@ Instruction *SPIRVEmitIntrinsics::visitAllocaInst(AllocaInst &I) {
TrackConstants = false;
Type *PtrTy = I.getType();
auto *NewI =
- ArraySize
- ? B.CreateIntrinsic(Intrinsic::spv_alloca_array,
- {PtrTy, ArraySize->getType()}, {ArraySize})
- : B.CreateIntrinsic(Intrinsic::spv_alloca, {PtrTy}, {});
+ ArraySize ? B.CreateIntrinsic(Intrinsic::spv_alloca_array,
+ {PtrTy, ArraySize->getType()}, {ArraySize})
+ : B.CreateIntrinsic(Intrinsic::spv_alloca, {PtrTy}, {});
std::string InstName = I.hasName() ? I.getName().str() : "";
I.replaceAllUsesWith(NewI);
I.eraseFromParent();
@@ -605,7 +604,7 @@ Instruction *SPIRVEmitIntrinsics::visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) {
Args.push_back(B.getInt32(
static_cast<uint32_t>(getMemSemantics(I.getFailureOrdering()))));
auto *NewI = B.CreateIntrinsic(Intrinsic::spv_cmpxchg,
- {I.getPointerOperand()->getType()}, {Args});
+ {I.getPointerOperand()->getType()}, {Args});
replaceMemInstrUses(&I, NewI, B);
return NewI;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/83015
More information about the llvm-commits
mailing list