[llvm] 23a22d0 - [SROA] Unify the names of new instructions created in SROA. (#167917)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 2 10:12:24 PST 2025
Author: Shubham Sandeep Rastogi
Date: 2025-12-02T10:12:20-08:00
New Revision: 23a22d0497eae08fa1ba7a0ecb2570eb07f5cfc8
URL: https://github.com/llvm/llvm-project/commit/23a22d0497eae08fa1ba7a0ecb2570eb07f5cfc8
DIFF: https://github.com/llvm/llvm-project/commit/23a22d0497eae08fa1ba7a0ecb2570eb07f5cfc8.diff
LOG: [SROA] Unify the names of new instructions created in SROA. (#167917)
In Debug builds, the names of adjusted pointers have a pointer-specific
name prefix which doesn't exist in non-debug builds.
This causes differences in output when looking at the output of SROA
with a Debug or Release compiler.
For most of our ongoing testing, we use essentially Release+Asserts
build (basically release but without NDEBUG defined), however we ship a
Release compiler. Therefore we want to say with reasonable confidence
that building a large project with Release vs a Release+Asserts build
gives us the same output when the same compiler version is used.
This difference however, makes it difficult to prove that the output is
the same if the only difference is the name when using LTO builds and
looking at bitcode.
Hence this change is being proposed.
Added:
Modified:
llvm/lib/Transforms/Scalar/SROA.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 5b1f0fc22dc28..a7c322bfcb981 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -3150,7 +3150,6 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
assert(IsSplit || BeginOffset == NewBeginOffset);
uint64_t Offset = NewBeginOffset - NewAllocaBeginOffset;
-#ifndef NDEBUG
StringRef OldName = OldPtr->getName();
// Skip through the last '.sroa.' component of the name.
size_t LastSROAPrefix = OldName.rfind(".sroa.");
@@ -3169,17 +3168,10 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
}
// Strip any SROA suffixes as well.
OldName = OldName.substr(0, OldName.find(".sroa_"));
-#endif
return getAdjustedPtr(IRB, DL, &NewAI,
APInt(DL.getIndexTypeSizeInBits(PointerTy), Offset),
- PointerTy,
-#ifndef NDEBUG
- Twine(OldName) + "."
-#else
- Twine()
-#endif
- );
+ PointerTy, Twine(OldName) + ".");
}
/// Compute suitable alignment to access this slice of the *new*
More information about the llvm-commits
mailing list