File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -209,12 +209,13 @@ class OpLowerer {
209209 void removeResourceGlobals (CallInst *CI) {
210210 for (User *User : make_early_inc_range (CI->users ())) {
211211 if (StoreInst *Store = dyn_cast<StoreInst>(User)) {
212- if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Store->getOperand (1 ))) {
213- Store->eraseFromParent ();
214- assert (GV->use_empty () && " Buffer global still has users" );
215- GV->removeDeadConstantUsers ();
216- GV->eraseFromParent ();
217- }
212+ Value *V = Store->getOperand (1 );
213+ Store->eraseFromParent ();
214+ if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
215+ if (GV->use_empty ()) {
216+ GV->removeDeadConstantUsers ();
217+ GV->eraseFromParent ();
218+ }
218219 }
219220 }
220221 }
Original file line number Diff line number Diff line change 11; RUN: opt -S -passes='early-cse<memssa>' %s -o %t
22; RUN: FileCheck --check-prefixes=CSE,CHECK %s < %t
33; finish compiling to verify that dxil-op-lower removes the globals entirely
4+ ; RUN: opt -S -dxil-op-lower %t -o - | FileCheck --check-prefixes=LLC,CHECK %s
45; RUN: llc -mtriple=dxil-pc-shadermodel6.0-compute --filetype=asm -o - %t | FileCheck --check-prefixes=LLC,CHECK %s
56; RUN: llc -mtriple=dxil-pc-shadermodel6.6-compute --filetype=asm -o - %t | FileCheck --check-prefixes=LLC,CHECK %s
67
You can’t perform that action at this time.
0 commit comments