2017-07-29 03:48:40 +08:00
|
|
|
# RUN: llc -run-pass=branch-folder %s -o - | FileCheck %s
|
|
|
|
|
|
|
|
# PR33980
|
|
|
|
|
|
|
|
# Don't form conditional tail calls when the original conditional branch has
|
|
|
|
# the same true and false destination. Otherwise, when we remove the tail call
|
|
|
|
# successor we will also remove the fallthrough successor from the CFG.
|
|
|
|
|
|
|
|
# CHECK: body: |
|
|
|
|
# CHECK: bb.0.entry:
|
2017-12-05 01:18:51 +08:00
|
|
|
# CHECK: successors: %bb.1(0x40000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK: liveins: $edi
|
|
|
|
# CHECK: CMP32ri8 killed $edi, 2, implicit-def $eflags
|
2017-07-29 03:48:40 +08:00
|
|
|
# CHECK: TCRETURNdi64cc @mergeable_conditional_tailcall
|
|
|
|
|
|
|
|
# This was the unconditional branch to a dead MBB that we left behind before
|
|
|
|
# this bug was fixed.
|
|
|
|
# CHECK-NOT: JMP_1 %bb.-1
|
|
|
|
|
|
|
|
--- |
|
|
|
|
; ModuleID = 't.ll'
|
|
|
|
source_filename = "t.ll"
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64--linux"
|
|
|
|
|
|
|
|
@static_local_guard = external global i64, align 8
|
|
|
|
|
|
|
|
; Function Attrs: optsize
|
|
|
|
define void @f(i32 %arg) #0 {
|
|
|
|
entry:
|
|
|
|
switch i32 %arg, label %sw.epilog [
|
|
|
|
i32 0, label %sw.bb
|
|
|
|
i32 1, label %sw.bb
|
|
|
|
i32 2, label %sw.bb2
|
|
|
|
]
|
|
|
|
|
|
|
|
sw.bb: ; preds = %entry, %entry
|
|
|
|
%tmp = load atomic i8, i8* bitcast (i64* @static_local_guard to i8*) acquire, align 8
|
|
|
|
%guard.uninitialized.i = icmp eq i8 %tmp, 0
|
|
|
|
br i1 %guard.uninitialized.i, label %init.check.i, label %return, !prof !0
|
|
|
|
|
|
|
|
init.check.i: ; preds = %sw.bb
|
|
|
|
tail call void @initialize_static_local(i64* nonnull @static_local_guard)
|
|
|
|
ret void
|
|
|
|
|
|
|
|
sw.bb2: ; preds = %entry
|
|
|
|
tail call void @mergeable_conditional_tailcall()
|
|
|
|
ret void
|
|
|
|
|
|
|
|
sw.epilog: ; preds = %entry
|
|
|
|
tail call void @mergeable_conditional_tailcall()
|
|
|
|
ret void
|
|
|
|
|
|
|
|
return: ; preds = %sw.bb
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @mergeable_conditional_tailcall()
|
|
|
|
|
|
|
|
declare void @initialize_static_local(i64*)
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
declare void @llvm.stackprotector(i8*, i8**) #1
|
|
|
|
|
|
|
|
attributes #0 = { optsize }
|
|
|
|
attributes #1 = { nounwind }
|
|
|
|
|
|
|
|
!0 = !{!"branch_weights", i32 1, i32 1048575}
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: f
|
[Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing
Summary:
This catches malformed mir files which specify alignment as log2 instead of pow2.
See https://reviews.llvm.org/D65945 for reference,
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: MatzeB, qcolombet, dschuff, arsenm, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67433
llvm-svn: 371608
2019-09-11 19:16:48 +08:00
|
|
|
alignment: 1
|
2017-07-29 03:48:40 +08:00
|
|
|
exposesReturnsTwice: false
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
|
|
|
selected: false
|
|
|
|
tracksRegLiveness: true
|
|
|
|
registers:
|
|
|
|
liveins:
|
2018-02-01 06:04:26 +08:00
|
|
|
- { reg: '$edi', virtual-reg: '' }
|
2017-07-29 03:48:40 +08:00
|
|
|
frameInfo:
|
|
|
|
isFrameAddressTaken: false
|
|
|
|
isReturnAddressTaken: false
|
|
|
|
hasStackMap: false
|
|
|
|
hasPatchPoint: false
|
|
|
|
stackSize: 0
|
|
|
|
offsetAdjustment: 0
|
|
|
|
maxAlignment: 0
|
|
|
|
adjustsStack: false
|
|
|
|
hasCalls: false
|
|
|
|
stackProtector: ''
|
|
|
|
maxCallFrameSize: 0
|
|
|
|
hasOpaqueSPAdjustment: false
|
|
|
|
hasVAStart: false
|
|
|
|
hasMustTailInVarArgFunc: false
|
|
|
|
savePoint: ''
|
|
|
|
restorePoint: ''
|
|
|
|
fixedStack:
|
|
|
|
stack:
|
|
|
|
constants:
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
2017-12-05 01:18:51 +08:00
|
|
|
successors: %bb.2(0x40000000), %bb.1(0x40000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $edi
|
2017-07-29 03:48:40 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
CMP32ri8 killed $edi, 2, implicit-def $eflags
|
[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, 2, implicit $eflags
|
2017-12-05 01:18:51 +08:00
|
|
|
JMP_1 %bb.1
|
2017-07-29 03:48:40 +08:00
|
|
|
|
|
|
|
bb.1.entry:
|
2017-12-05 01:18:51 +08:00
|
|
|
successors: %bb.4(0x40000000), %bb.5(0x40000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $eflags
|
2017-07-29 03:48:40 +08:00
|
|
|
|
[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.4, 4, implicit killed $eflags
|
2017-12-05 01:18:51 +08:00
|
|
|
JMP_1 %bb.5
|
2017-07-29 03:48:40 +08:00
|
|
|
|
|
|
|
bb.2.sw.bb:
|
2017-12-05 01:18:51 +08:00
|
|
|
successors: %bb.3(0x00000800), %bb.6(0x7ffff800)
|
2017-07-29 03:48:40 +08:00
|
|
|
|
2018-08-04 05:40:44 +08:00
|
|
|
$al = MOV8rm $rip, 1, $noreg, @static_local_guard, $noreg :: (volatile load acquire 1 from `i8* bitcast (i64* @static_local_guard to i8*)`, align 8)
|
2018-02-01 06:04:26 +08:00
|
|
|
TEST8rr killed $al, $al, implicit-def $eflags
|
[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.6, 5, implicit killed $eflags
|
2017-12-05 01:18:51 +08:00
|
|
|
JMP_1 %bb.3
|
2017-07-29 03:48:40 +08:00
|
|
|
|
|
|
|
bb.3.init.check.i:
|
2018-08-11 13:33:00 +08:00
|
|
|
dead $edi = MOV32ri @static_local_guard, implicit-def $rdi
|
2018-02-01 06:04:26 +08:00
|
|
|
TCRETURNdi64 @initialize_static_local, 0, csr_64, implicit $rsp, implicit $rdi
|
2017-07-29 03:48:40 +08:00
|
|
|
|
|
|
|
bb.4.sw.bb2:
|
2018-02-01 06:04:26 +08:00
|
|
|
TCRETURNdi64 @mergeable_conditional_tailcall, 0, csr_64, implicit $rsp
|
2017-07-29 03:48:40 +08:00
|
|
|
|
|
|
|
bb.5.sw.epilog:
|
2018-02-01 06:04:26 +08:00
|
|
|
TCRETURNdi64 @mergeable_conditional_tailcall, 0, csr_64, implicit $rsp
|
2017-07-29 03:48:40 +08:00
|
|
|
|
|
|
|
bb.6.return:
|
|
|
|
RET 0
|
|
|
|
|
|
|
|
...
|