[all-commits] [llvm/llvm-project] 3114bd: [StackColoring] Do not drop AA metadata when not d...
Björn Pettersson via All-commits
all-commits at lists.llvm.org
Thu Nov 23 09:10:53 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3114bd32e758b0f25cfa3dee5fa520e45f8fe491
https://github.com/llvm/llvm-project/commit/3114bd32e758b0f25cfa3dee5fa520e45f8fe491
Author: Björn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2023-11-23 (Thu, 23 Nov 2023)
Changed paths:
M llvm/lib/CodeGen/StackColoring.cpp
A llvm/test/CodeGen/X86/StackColoring-tbaa.mir
Log Message:
-----------
[StackColoring] Do not drop AA metadata when not doing remappings (#71958)
In the StackColoring pass we first scan for possible stack slot merges.
A SlotRemap map is setup with the remappings that should be performed.
Then the main work is done by calling remapInstructions and providing
that map.
Most of the work in remapInstructions would just be a waste of time in
situations when the SlotRemap map is empty, but it turns out that the
part that adjusts Alias Analysis information could end up dropping AA
metadata even when there are no stack slot merges being done. This
happens since all instruction's machine memory operands are considered,
and if we can't determine the underlying object that is accessed (using
getUnderlyingObjectsForCodeGen) then we conservatively drop AA metadata.
This patch simply avoids calling remapInstructions if we don't intend to
do any remappings (i.e. if SlotRemap is empty). That avoids touching AA
metadata when all we do is to remove lifetime markers. That seems like a
safe thing to do, as it is the same thing as happens when we bail out
early due to other reasons (e.g. when only having one lifetime marker).
For targets that do not care about Alias Analysis information after the
StackColoring pass this shouldn't have any impact, except that it might
improve compile time slightly as we now skip spending time in
remapInstructions when not doing any stack merges.
More information about the All-commits
mailing list