[llvm] [DirectX] Eliminate resource global variables from module (PR #114105)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 16:58:17 PDT 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 af44976cad04d8470f205f557eaf172ee1eff0df d013656cfcc9ababfe0707a9cf7157ebe1e3d191 --extensions cpp -- llvm/lib/Target/DirectX/DXILOpLowering.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index 34b2253a52..8e15f114af 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -204,22 +204,22 @@ public:
CleanupCasts.clear();
}
- // Remove the resource global associated with the handleFromBinding call instruction
- // and their uses as they aren't needed anymore.
+ // Remove the resource global associated with the handleFromBinding call
+ // instruction and their uses as they aren't needed anymore.
void removeResourceGlobals(CallInst *CI) {
for (User *User : make_early_inc_range(CI->users())) {
- if(StoreInst *Store = dyn_cast<StoreInst>(User)) {
- if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Store->getOperand(1))) {
- Store->eraseFromParent();
- assert(GV->use_empty() && "Buffer global still has users");
- GV->removeDeadConstantUsers();
- GV->eraseFromParent();
- }
+ if (StoreInst *Store = dyn_cast<StoreInst>(User)) {
+ if (GlobalVariable *GV =
+ dyn_cast<GlobalVariable>(Store->getOperand(1))) {
+ Store->eraseFromParent();
+ assert(GV->use_empty() && "Buffer global still has users");
+ GV->removeDeadConstantUsers();
+ GV->eraseFromParent();
+ }
}
}
}
-
[[nodiscard]] bool lowerToCreateHandle(Function &F) {
IRBuilder<> &IRB = OpBuilder.getIRB();
Type *Int8Ty = IRB.getInt8Ty();
``````````
</details>
https://github.com/llvm/llvm-project/pull/114105
More information about the llvm-commits
mailing list