[PATCH] D142127: [llvm][codegen] Fix non-determinism in StackFrameLayoutAnalysisPass output
Paul Kirth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 09:47:58 PST 2023
paulkirth updated this revision to Diff 490564.
paulkirth edited the summary of this revision.
paulkirth added a comment.
Herald added a subscriber: kristof.beyls.
Remove checks added to arm test, since they break under reverse iteration.
The test now just ignores the lines related to Stack Frame Analaysis, which is probably a better choice anyway.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142127/new/
https://reviews.llvm.org/D142127
Files:
llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
llvm/test/CodeGen/AArch64/arm64-opt-remarks-lazy-bfi.ll
Index: llvm/test/CodeGen/AArch64/arm64-opt-remarks-lazy-bfi.ll
===================================================================
--- llvm/test/CodeGen/AArch64/arm64-opt-remarks-lazy-bfi.ll
+++ llvm/test/CodeGen/AArch64/arm64-opt-remarks-lazy-bfi.ll
@@ -38,13 +38,7 @@
; HOTNESS-NEXT: Freeing Pass 'Insert CFI remember/restore state instructions' on Function 'empty_func'
; HOTNESS-NEXT: Executing Pass 'Verify generated machine code'
; HOTNESS-NEXT: Freeing Pass 'Verify generated machine code'
-; HOTNESS-NEXT: Executing Pass 'Lazy Machine Block Frequency Analysis'
-; HOTNESS-NEXT: Executing Pass 'Machine Optimization Remark Emitter'
-; HOTNESS: Executing Pass 'Stack Frame Layout Analysis'
-; HOTNESS-NEXT: Freeing Pass 'Machine Optimization Remark Emitter'
-; HOTNESS-NEXT: Freeing Pass 'Lazy Machine Block Frequency Analysis'
-; HOTNESS-NEXT: Freeing Pass 'Stack Frame Layout Analysis'
-; HOTNESS-NEXT: Executing Pass 'Unpack machine instruction bundles'
+; HOTNESS: Executing Pass 'Unpack machine instruction bundles'
; HOTNESS-NEXT: Freeing Pass 'Unpack machine instruction bundles'
; HOTNESS-NEXT: Executing Pass 'Verify generated machine code'
; HOTNESS-NEXT: Freeing Pass 'Verify generated machine code'
@@ -69,13 +63,7 @@
; NO_HOTNESS-NEXT: Freeing Pass 'Insert CFI remember/restore state instructions' on Function 'empty_func'
; NO_HOTNESS-NEXT: Executing Pass 'Verify generated machine code'
; NO_HOTNESS-NEXT: Freeing Pass 'Verify generated machine code'
-; NO_HOTNESS-NEXT: Executing Pass 'Lazy Machine Block Frequency Analysis'
-; NO_HOTNESS-NEXT: Executing Pass 'Machine Optimization Remark Emitter'
-; NO_HOTNESS: Executing Pass 'Stack Frame Layout Analysis'
-; NO_HOTNESS-NEXT: Freeing Pass 'Machine Optimization Remark Emitter'
-; NO_HOTNESS-NEXT: Freeing Pass 'Lazy Machine Block Frequency Analysis'
-; NO_HOTNESS-NEXT: Freeing Pass 'Stack Frame Layout Analysis'
-; NO_HOTNESS-NEXT: Executing Pass 'Unpack machine instruction bundles'
+; NO_HOTNESS: Executing Pass 'Unpack machine instruction bundles'
; NO_HOTNESS-NEXT: Freeing Pass 'Unpack machine instruction bundles'
; NO_HOTNESS-NEXT: Executing Pass 'Verify generated machine code'
; NO_HOTNESS-NEXT: Freeing Pass 'Verify generated machine code'
Index: llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
===================================================================
--- llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
+++ llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
@@ -16,6 +16,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -45,8 +46,7 @@
/// MachineFunction.
///
struct StackFrameLayoutAnalysisPass : public MachineFunctionPass {
- using SlotDbgMap =
- SmallDenseMap<int, SmallPtrSet<const DILocalVariable *, 4>>;
+ using SlotDbgMap = SmallDenseMap<int, SetVector<const DILocalVariable *>>;
static char ID;
enum SlotType {
@@ -180,18 +180,15 @@
<< MFI.getStackProtectorIndex() << "\n");
std::vector<SlotData> SlotInfo;
- SmallDenseMap<int, int> SlotOffsetMap;
const unsigned int NumObj = MFI.getNumObjects();
SlotInfo.reserve(NumObj);
- SlotOffsetMap.reserve(NumObj);
// initialize slot info
for (int Idx = MFI.getObjectIndexBegin(), EndIdx = MFI.getObjectIndexEnd();
Idx != EndIdx; ++Idx) {
if (MFI.isDeadObjectIndex(Idx))
continue;
- auto &Inserted = SlotInfo.emplace_back(MFI, ValOffset, Idx);
- SlotOffsetMap[Inserted.Slot] = Inserted.Offset;
+ SlotInfo.emplace_back(MFI, ValOffset, Idx);
}
// sort the ordering, to match the actual layout in memory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142127.490564.patch
Type: text/x-patch
Size: 3833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230119/de0d37d3/attachment.bin>
More information about the llvm-commits
mailing list