[llvm] a93e04c - [AddressSanitizer] Remove unnecessary zero-index GEP

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 06:04:20 PST 2026


Author: Nikita Popov
Date: 2026-02-13T15:02:30+01:00
New Revision: a93e04cf8341242c551561dc2619943e1407a87b

URL: https://github.com/llvm/llvm-project/commit/a93e04cf8341242c551561dc2619943e1407a87b
DIFF: https://github.com/llvm/llvm-project/commit/a93e04cf8341242c551561dc2619943e1407a87b.diff

LOG: [AddressSanitizer] Remove unnecessary zero-index GEP

This is a no-op.

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 2d4c4c9b057c6..54fa484ac763f 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2673,12 +2673,7 @@ void ModuleAddressSanitizer::instrumentGlobals(IRBuilder<> &IRB,
     // zero so we can copy the metadata over as is.
     NewGlobal->copyMetadata(G, 0);
 
-    Value *Indices2[2];
-    Indices2[0] = IRB.getInt32(0);
-    Indices2[1] = IRB.getInt32(0);
-
-    G->replaceAllUsesWith(
-        ConstantExpr::getGetElementPtr(NewTy, NewGlobal, Indices2, true));
+    G->replaceAllUsesWith(NewGlobal);
     NewGlobal->takeName(G);
     G->eraseFromParent();
     NewGlobals[i] = NewGlobal;


        


More information about the llvm-commits mailing list