Skip to content

Commit 02c4c95

Browse files
committed
add options no-tail-merge and enable-tail-merge
1 parent ad832b4 commit 02c4c95

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

llvm/include/llvm/Passes/MachinePassRegistry.def

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,11 @@ MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifi
196196

197197
MACHINE_FUNCTION_PASS_WITH_PARAMS(
198198
"block-placement", "MachineBlockPlacementPass",
199-
[](bool NoTailMerge) {
200-
// Tail merging is enabled by default, so this option
201-
// is to disable it.
202-
return MachineBlockPlacementPass(!NoTailMerge);
199+
[](bool AllowTailMerge) {
200+
// Default is true.
201+
return MachineBlockPlacementPass(AllowTailMerge);
203202
},
204-
[](StringRef Params) {
205-
return parseSinglePassOption(Params, "no-tail-merge",
206-
"MachineBlockPlacementPass");
207-
},
208-
"no-tail-merge")
203+
parseMachineBlockPlacementPassOptions, "no-tail-merge;enable-tail-merge")
209204

210205
MACHINE_FUNCTION_PASS_WITH_PARAMS(
211206
"machine-sink", "MachineSinkingPass",

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,19 @@ Expected<bool> parseMachineSinkingPassOptions(StringRef Params) {
14401440
"MachineSinkingPass");
14411441
}
14421442

1443+
Expected<bool> parseMachineBlockPlacementPassOptions(StringRef Params) {
1444+
bool AllowTailMerge = true;
1445+
if (Params == "no-tail-merge")
1446+
AllowTailMerge = false;
1447+
else if (!Params.empty() && Params != "enable-tail-merge")
1448+
return make_error<StringError>(
1449+
formatv("invalid MachineBlockPlacementPass parameter '{0}' ", Params)
1450+
.str(),
1451+
inconvertibleErrorCode());
1452+
1453+
return AllowTailMerge;
1454+
}
1455+
14431456
} // namespace
14441457

14451458
/// Tests whether a pass name starts with a valid prefix for a default pipeline

llvm/test/CodeGen/AMDGPU/loop_header_nopred.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# RUN: llc -mtriple=amdgcn -o - -run-pass=block-placement -mcpu=gfx1010 -mattr=-inst-fwd-prefetch-bug -verify-machineinstrs %s | FileCheck -check-prefixes=GFX10 %s
33
# RUN: llc -mtriple=amdgcn -o - -run-pass=block-placement -mcpu=gfx1100 -mattr=-inst-fwd-prefetch-bug -verify-machineinstrs %s | FileCheck -check-prefixes=GFX11 %s
44

5-
# RUN: llc -mtriple=amdgcn -o - -passes='require<profile-summary>,function(machine-function(block-placement))' -mcpu=gfx1100 -mattr=-inst-fwd-prefetch-bug -verify-machineinstrs %s | FileCheck -check-prefixes=GFX11 %s
5+
# RUN: llc -mtriple=amdgcn -o - -passes='require<profile-summary>,function(machine-function(block-placement<enable-tail-merge>))' -mcpu=gfx1100 -mattr=-inst-fwd-prefetch-bug -verify-machineinstrs %s | FileCheck -check-prefixes=GFX11 %s
66

77
# Used to fail with
88
# Assertion `Out && "Header of loop has no predecessors from outside loop?"

0 commit comments

Comments
 (0)