mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
This reverts r317579, originally committed as r317100.
There is a design issue with marking CFI instructions duplicatable. Not
all targets support the CFIInstrInserter pass, and targets like Darwin
can't cope with duplicated prologue setup CFI instructions. The compact
unwind info emission fails.
When the following code is compiled for arm64 on Mac at -O3, the CFI
instructions end up getting tail duplicated, which causes compact unwind
info emission to fail:
int a, c, d, e, f, g, h, i, j, k, l, m;
void n(int o, int *b) {
if (g)
f = 0;
for (; f < o; f++) {
m = a;
if (l > j * k > i)
j = i = k = d;
h = b[c] - e;
}
}
We get assembly that looks like this:
; BB#1: ; %if.then
Lloh3:
adrp x9, _f@GOTPAGE
Lloh4:
ldr x9, [x9, _f@GOTPAGEOFF]
mov w8, wzr
Lloh5:
str wzr, [x9]
stp x20, x19, [sp, #-16]! ; 8-byte Folded Spill
.cfi_def_cfa_offset 16
.cfi_offset w19, -8
.cfi_offset w20, -16
cmp w8, w0
b.lt LBB0_3
b LBB0_7
LBB0_2: ; %entry.if.end_crit_edge
Lloh6:
adrp x8, _f@GOTPAGE
Lloh7:
ldr x8, [x8, _f@GOTPAGEOFF]
Lloh8:
ldr w8, [x8]
stp x20, x19, [sp, #-16]! ; 8-byte Folded Spill
.cfi_def_cfa_offset 16
.cfi_offset w19, -8
.cfi_offset w20, -16
cmp w8, w0
b.ge LBB0_7
LBB0_3: ; %for.body.lr.ph
Note the multiple .cfi_def* directives. Compact unwind info emission
can't handle that.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317726 91177308-0d34-0410-b5e6-96231b3b80d8
139 lines
3.2 KiB
LLVM
139 lines
3.2 KiB
LLVM
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=0 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s
|
|
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWON %s
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -fixup-byte-word-insts=0 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s
|
|
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWON %s
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -fixup-byte-word-insts=0 | \
|
|
; RUN: FileCheck -check-prefix=DARWIN -check-prefix=DARWIN-BWOFF %s
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -fixup-byte-word-insts=1 | \
|
|
; RUN: FileCheck -check-prefix=DARWIN -check-prefix=DARWIN-BWON %s
|
|
|
|
|
|
@x = common global i32 0, align 4
|
|
|
|
define zeroext i1 @unsigned_i1() {
|
|
entry:
|
|
%0 = load i32, i32* @x
|
|
%cmp = icmp eq i32 %0, 42
|
|
ret i1 %cmp
|
|
|
|
; Unsigned i1 return values are not extended.
|
|
; CHECK-LABEL: unsigned_i1:
|
|
; CHECK: cmp
|
|
; CHECK-NEXT: sete
|
|
; CHECK-NEXT: ret
|
|
}
|
|
|
|
define zeroext i8 @unsigned_i8() {
|
|
entry:
|
|
%0 = load i32, i32* @x
|
|
%cmp = icmp eq i32 %0, 42
|
|
%retval = zext i1 %cmp to i8
|
|
ret i8 %retval
|
|
|
|
; Unsigned i8 return values are not extended.
|
|
; CHECK-LABEL: unsigned_i8:
|
|
; CHECK: cmp
|
|
; CHECK-NEXT: sete
|
|
; CHECK-NEXT: ret
|
|
|
|
; Except on Darwin, for legacy reasons.
|
|
; DARWIN-LABEL: unsigned_i8:
|
|
; DARWIN: xorl
|
|
; DARWIN-NEXT: cmp
|
|
; DARWIN-NEXT: sete
|
|
; DARWIN-NEXT: ret
|
|
}
|
|
|
|
define signext i8 @signed_i8() {
|
|
entry:
|
|
%0 = load i32, i32* @x
|
|
%cmp = icmp eq i32 %0, 42
|
|
%retval = zext i1 %cmp to i8
|
|
ret i8 %retval
|
|
|
|
; Signed i8 return values are not extended.
|
|
; CHECK-LABEL: signed_i8:
|
|
; CHECK: cmp
|
|
; CHECK-NEXT: sete
|
|
; CHECK-NEXT: ret
|
|
|
|
; Except on Darwin, for legacy reasons.
|
|
; DARWIN-LABEL: signed_i8:
|
|
; DARWIN: xorl
|
|
; DARWIN-NEXT: cmp
|
|
; DARWIN-NEXT: sete
|
|
; DARWIN-NEXT: ret
|
|
}
|
|
|
|
@a = common global i16 0
|
|
@b = common global i16 0
|
|
define zeroext i16 @unsigned_i16() {
|
|
entry:
|
|
%0 = load i16, i16* @a
|
|
%1 = load i16, i16* @b
|
|
%add = add i16 %1, %0
|
|
ret i16 %add
|
|
|
|
; i16 return values are not extended.
|
|
; CHECK-LABEL: unsigned_i16:
|
|
; BWOFF: movw
|
|
; BWON: movzwl
|
|
; CHECK-NEXT: addw
|
|
; CHECK-NEXT: ret
|
|
|
|
; Except on Darwin, for legacy reasons.
|
|
; DARWIN-LABEL: unsigned_i16:
|
|
; DARWIN-BWOFF: movw
|
|
; DARWIN-BWON: movzwl
|
|
; DARWIN-NEXT: addw
|
|
; DARWIN-NEXT: movzwl
|
|
; DARWIN-NEXT: ret
|
|
}
|
|
|
|
|
|
define i32 @use_i1() {
|
|
entry:
|
|
%0 = call i1 @unsigned_i1();
|
|
%1 = zext i1 %0 to i32
|
|
ret i32 %1
|
|
|
|
; The high 24 bits of %eax from a function returning i1 are undefined.
|
|
; CHECK-LABEL: use_i1:
|
|
; CHECK: call
|
|
; CHECK-NEXT: movzbl
|
|
; CHECK-NEXT: {{pop|add}}
|
|
; CHECK-NEXT: ret
|
|
}
|
|
|
|
define i32 @use_i8() {
|
|
entry:
|
|
%0 = call i8 @unsigned_i8();
|
|
%1 = zext i8 %0 to i32
|
|
ret i32 %1
|
|
|
|
; The high 24 bits of %eax from a function returning i8 are undefined.
|
|
; CHECK-LABEL: use_i8:
|
|
; CHECK: call
|
|
; CHECK-NEXT: movzbl
|
|
; CHECK-NEXT: {{pop|add}}
|
|
; CHECK-NEXT: ret
|
|
}
|
|
|
|
define i32 @use_i16() {
|
|
entry:
|
|
%0 = call i16 @unsigned_i16();
|
|
%1 = zext i16 %0 to i32
|
|
ret i32 %1
|
|
|
|
; The high 16 bits of %eax from a function returning i16 are undefined.
|
|
; CHECK-LABEL: use_i16:
|
|
; CHECK: call
|
|
; CHECK-NEXT: movzwl
|
|
; CHECK-NEXT: {{pop|add}}
|
|
; CHECK-NEXT: ret
|
|
}
|