Skip to content

Commit

Permalink
Refine the commit f9da391
Browse files Browse the repository at this point in the history
A better way to use Map.
  • Loading branch information
AMD-dwang committed Nov 30, 2023
1 parent 60e7a44 commit 4f0e992
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions llpc/lower/llpcSpirvLowerConstImmediateStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,12 @@ bool SpirvLowerConstImmediateStore::tryProcessAlloca(AllocaInst *allocaInst) {
}

// Step 3: Create the global variable and replace the alloca
GlobalVariable *global = nullptr;
auto iter = m_allocToGlobals.find(initializer);
if (iter == m_allocToGlobals.end()) {
GlobalVariable *&global = m_allocToGlobals[initializer];
if (!global) {
global = new GlobalVariable(*m_module, allocatedTy,
true, // isConstant
GlobalValue::InternalLinkage, initializer, "", nullptr, GlobalValue::NotThreadLocal,
SPIRAS_Constant);
m_allocToGlobals[initializer] = global;
} else {
global = iter->second;
}
global->takeName(allocaInst);

Expand Down

0 comments on commit 4f0e992

Please sign in to comment.