2017-08-02 08:28:10 +08:00
|
|
|
# RUN: llc -mtriple=x86_64-- -verify-machineinstrs -run-pass block-placement -o - %s | FileCheck %s
|
2016-07-04 03:14:17 +08:00
|
|
|
# Check the conditional jump in bb.1 is changed to unconditional after block placement swaps bb.2 and bb.3.
|
|
|
|
|
|
|
|
--- |
|
|
|
|
@a = external global i16
|
|
|
|
@b = external global i32
|
|
|
|
|
Codegen: Tail-duplicate during placement.
The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.
In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.
This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.
Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.
Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.
Issue with early tail-duplication of blocks that branch to a fallthrough
predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll
Differential revision: https://reviews.llvm.org/D18226
llvm-svn: 283934
2016-10-12 04:36:43 +08:00
|
|
|
declare void @dummy1()
|
|
|
|
declare void @dummy2()
|
|
|
|
declare void @dummy3()
|
|
|
|
|
2016-07-04 03:14:17 +08:00
|
|
|
; Function Attrs: nounwind
|
|
|
|
define void @f2() {
|
|
|
|
br i1 undef, label %bb1, label %bb3
|
|
|
|
|
|
|
|
bb1:
|
Codegen: Tail-duplicate during placement.
The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.
In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.
This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.
Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.
Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.
Issue with early tail-duplication of blocks that branch to a fallthrough
predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll
Differential revision: https://reviews.llvm.org/D18226
llvm-svn: 283934
2016-10-12 04:36:43 +08:00
|
|
|
call void @dummy1()
|
|
|
|
call void @dummy1()
|
|
|
|
call void @dummy1()
|
2016-07-04 03:14:17 +08:00
|
|
|
br i1 undef, label %bb2, label %bb2
|
|
|
|
|
|
|
|
bb2:
|
Codegen: Tail-duplicate during placement.
The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.
In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.
This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.
Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.
Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.
Issue with early tail-duplication of blocks that branch to a fallthrough
predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll
Differential revision: https://reviews.llvm.org/D18226
llvm-svn: 283934
2016-10-12 04:36:43 +08:00
|
|
|
call void @dummy2()
|
|
|
|
call void @dummy2()
|
|
|
|
call void @dummy2()
|
2016-07-04 03:14:17 +08:00
|
|
|
br label %bb4
|
|
|
|
|
|
|
|
bb3:
|
Codegen: Tail-duplicate during placement.
The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.
In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.
This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.
Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.
Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.
Issue with early tail-duplication of blocks that branch to a fallthrough
predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll
Differential revision: https://reviews.llvm.org/D18226
llvm-svn: 283934
2016-10-12 04:36:43 +08:00
|
|
|
call void @dummy3()
|
|
|
|
call void @dummy3()
|
|
|
|
call void @dummy3()
|
2016-07-04 03:14:17 +08:00
|
|
|
br label %bb2
|
|
|
|
|
|
|
|
bb4:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
# CHECK-LABEL: name: f2
|
|
|
|
# CHECK: bb.1:
|
|
|
|
# CHECK: JMP_1 %bb.2
|
|
|
|
# CHECK: bb.3:
|
|
|
|
# CHECK: bb.2:
|
|
|
|
name: f2
|
|
|
|
body: |
|
|
|
|
bb.0 (%ir-block.0):
|
|
|
|
successors: %bb.1(50), %bb.3(50)
|
|
|
|
|
[X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.
Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.
Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon
Reviewed By: RKSimon
Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60228
llvm-svn: 357802
2019-04-06 03:28:09 +08:00
|
|
|
JCC_1 %bb.1, 2, implicit $eflags
|
2016-07-04 03:14:17 +08:00
|
|
|
JMP_1 %bb.3
|
|
|
|
bb.1:
|
|
|
|
successors: %bb.2(100)
|
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
CALL64pcrel32 @dummy1, csr_64, implicit $rsp, implicit-def $rsp
|
|
|
|
CALL64pcrel32 @dummy1, csr_64, implicit $rsp, implicit-def $rsp
|
|
|
|
CALL64pcrel32 @dummy1, csr_64, implicit $rsp, implicit-def $rsp
|
[X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.
Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.
Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon
Reviewed By: RKSimon
Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60228
llvm-svn: 357802
2019-04-06 03:28:09 +08:00
|
|
|
JCC_1 %bb.2, 5, implicit $eflags
|
2016-07-04 03:14:17 +08:00
|
|
|
|
|
|
|
bb.2:
|
|
|
|
successors: %bb.4(100)
|
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
CALL64pcrel32 @dummy2, csr_64, implicit $rsp, implicit-def $rsp
|
|
|
|
CALL64pcrel32 @dummy2, csr_64, implicit $rsp, implicit-def $rsp
|
|
|
|
CALL64pcrel32 @dummy2, csr_64, implicit $rsp, implicit-def $rsp
|
2016-07-04 03:14:17 +08:00
|
|
|
JMP_1 %bb.4
|
|
|
|
|
|
|
|
bb.3:
|
|
|
|
successors: %bb.2(100)
|
2018-02-01 06:04:26 +08:00
|
|
|
CALL64pcrel32 @dummy3, csr_64, implicit $rsp, implicit-def $rsp
|
|
|
|
CALL64pcrel32 @dummy3, csr_64, implicit $rsp, implicit-def $rsp
|
|
|
|
CALL64pcrel32 @dummy3, csr_64, implicit $rsp, implicit-def $rsp
|
2016-07-04 03:14:17 +08:00
|
|
|
JMP_1 %bb.2
|
|
|
|
|
|
|
|
bb.4:
|
|
|
|
RETQ
|
|
|
|
|
|
|
|
...
|