Skip to content

Commit 316c784

Browse files
committed
add options no-tail-merge and enable-tail-merge
1 parent b0b5c52 commit 316c784

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
@@ -195,16 +195,11 @@ MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifi
195195

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

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

llvm/lib/Passes/PassBuilder.cpp

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

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

14441457
/// 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)