Skip to content

Commit 61a5d4d

Browse files
rastogishubhamkcloudy0717
authored andcommitted
[SROA] Unify the names of new instructions created in SROA. (llvm#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.
1 parent 31fd319 commit 61a5d4d

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3150,7 +3150,6 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
31503150
assert(IsSplit || BeginOffset == NewBeginOffset);
31513151
uint64_t Offset = NewBeginOffset - NewAllocaBeginOffset;
31523152

3153-
#ifndef NDEBUG
31543153
StringRef OldName = OldPtr->getName();
31553154
// Skip through the last '.sroa.' component of the name.
31563155
size_t LastSROAPrefix = OldName.rfind(".sroa.");
@@ -3169,17 +3168,10 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
31693168
}
31703169
// Strip any SROA suffixes as well.
31713170
OldName = OldName.substr(0, OldName.find(".sroa_"));
3172-
#endif
31733171

31743172
return getAdjustedPtr(IRB, DL, &NewAI,
31753173
APInt(DL.getIndexTypeSizeInBits(PointerTy), Offset),
3176-
PointerTy,
3177-
#ifndef NDEBUG
3178-
Twine(OldName) + "."
3179-
#else
3180-
Twine()
3181-
#endif
3182-
);
3174+
PointerTy, Twine(OldName) + ".");
31833175
}
31843176

31853177
/// Compute suitable alignment to access this slice of the *new*

0 commit comments

Comments
 (0)