Skip to content

Commit d970350

Browse files
authored
[MTE] [NFC] use vector to collect globals to tag (#120283)
The same pattern caused test failures in the HWASan pass, so is brittle. Let's go for the easier approach.
1 parent e532241 commit d970350

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,11 +2444,14 @@ bool AsmPrinter::doFinalization(Module &M) {
24442444
// we can conditionalize accesses based on whether or not it is nullptr.
24452445
MF = nullptr;
24462446

2447-
for (GlobalVariable &G : make_early_inc_range(M.globals())) {
2447+
std::vector<GlobalVariable *> GlobalsToTag;
2448+
for (GlobalVariable &G : M.globals()) {
24482449
if (G.isDeclaration() || !G.isTagged())
24492450
continue;
2450-
tagGlobalDefinition(M, &G);
2451+
GlobalsToTag.push_back(&G);
24512452
}
2453+
for (GlobalVariable *G : GlobalsToTag)
2454+
tagGlobalDefinition(M, G);
24522455

24532456
// Gather all GOT equivalent globals in the module. We really need two
24542457
// passes over the globals: one to compute and another to avoid its emission

0 commit comments

Comments
 (0)