From 1cb6be8c8f350f87635b22f473b882cb39636305 Mon Sep 17 00:00:00 2001 From: Shubham Sandeep Rastogi Date: Wed, 12 Nov 2025 11:15:24 -0800 Subject: [PATCH] [SROA] Unify the names of new instructions created in SROA. 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. --- llvm/lib/Transforms/Scalar/SROA.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 5c60fad6f91aa..70afe833c9f47 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3150,7 +3150,6 @@ class AllocaSliceRewriter : public InstVisitor { 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 { } // 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*