You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.207
Former-commit-id: 3b152f462918d427ce18620a2cbe4f8b79650449
This commit is contained in:
parent
8e12397d70
commit
eb85e2fc17
@ -1,30 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='consthoist' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
; Check if the materialization of the constant and the cast instruction are
|
||||
; inserted in the correct order.
|
||||
define i32 @cast_inst_test() {
|
||||
; CHECK-LABEL: @cast_inst_test
|
||||
; CHECK: %const = bitcast i64 4646526064 to i64
|
||||
; CHECK: %1 = inttoptr i64 %const to i32*
|
||||
; CHECK: %v0 = load i32, i32* %1, align 16
|
||||
; CHECK: %const_mat = add i64 %const, 16
|
||||
; CHECK-NEXT: %2 = inttoptr i64 %const_mat to i32*
|
||||
; CHECK-NEXT: %v1 = load i32, i32* %2, align 16
|
||||
; CHECK: %const_mat1 = add i64 %const, 32
|
||||
; CHECK-NEXT: %3 = inttoptr i64 %const_mat1 to i32*
|
||||
; CHECK-NEXT: %v2 = load i32, i32* %3, align 16
|
||||
%a0 = inttoptr i64 4646526064 to i32*
|
||||
%v0 = load i32, i32* %a0, align 16
|
||||
%a1 = inttoptr i64 4646526080 to i32*
|
||||
%v1 = load i32, i32* %a1, align 16
|
||||
%a2 = inttoptr i64 4646526096 to i32*
|
||||
%v2 = load i32, i32* %a2, align 16
|
||||
%r0 = add i32 %v0, %v1
|
||||
%r1 = add i32 %r0, %v2
|
||||
ret i32 %r1
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
%T = type { i32, i32, i32, i32 }
|
||||
|
||||
; Test if even cheap base addresses are hoisted.
|
||||
define i32 @test1() nounwind {
|
||||
; CHECK-LABEL: @test1
|
||||
; CHECK: %const = bitcast i32 12345678 to i32
|
||||
; CHECK: %1 = inttoptr i32 %const to %T*
|
||||
; CHECK: %addr1 = getelementptr %T, %T* %1, i32 0, i32 1
|
||||
%addr1 = getelementptr %T, %T* inttoptr (i32 12345678 to %T*), i32 0, i32 1
|
||||
%tmp1 = load i32, i32* %addr1
|
||||
%addr2 = getelementptr %T, %T* inttoptr (i32 12345678 to %T*), i32 0, i32 2
|
||||
%tmp2 = load i32, i32* %addr2
|
||||
%addr3 = getelementptr %T, %T* inttoptr (i32 12345678 to %T*), i32 0, i32 3
|
||||
%tmp3 = load i32, i32* %addr3
|
||||
%tmp4 = add i32 %tmp1, %tmp2
|
||||
%tmp5 = add i32 %tmp3, %tmp4
|
||||
ret i32 %tmp5
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
; ModuleID = 'test-hoist-debug.cpp'
|
||||
source_filename = "test-hoist-debug.cpp"
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: noinline nounwind optnone uwtable
|
||||
define i32 @_Z3foov() !dbg !7 {
|
||||
; CHECK: bitcast
|
||||
; CHECK-NOT: !dbg !11
|
||||
; CHECK: inttoptr
|
||||
entry:
|
||||
%a0 = inttoptr i64 4646526064 to i32*
|
||||
%v0 = load i32, i32* %a0, align 16, !dbg !11
|
||||
%c = alloca i32, align 4
|
||||
store i32 1, i32* %c, align 4
|
||||
%0 = load i32, i32* %c, align 4
|
||||
%cmp = icmp eq i32 %0, 0
|
||||
br i1 %cmp, label %if.then, label %if.else
|
||||
|
||||
if.then: ; preds = %entry
|
||||
%a1 = inttoptr i64 4646526080 to i32*
|
||||
%v1 = load i32, i32* %a1, align 16, !dbg !11
|
||||
br label %return
|
||||
|
||||
if.else: ; preds = %entry
|
||||
%a2 = inttoptr i64 4646526096 to i32*
|
||||
%v2 = load i32, i32* %a2, align 16, !dbg !11
|
||||
br label %return
|
||||
|
||||
return: ; preds = %if.else, %if.then
|
||||
%vx = phi i32 [%v1, %if.then], [%v2, %if.else]
|
||||
%r0 = add i32 %vx, %v0
|
||||
|
||||
ret i32 %r0
|
||||
}
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!3, !4, !5}
|
||||
!llvm.ident = !{!6}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 313291)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
||||
!1 = !DIFile(filename: "test-hoist-debug.cpp", directory: "/tmp")
|
||||
!2 = !{}
|
||||
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!5 = !{i32 1, !"wchar_size", i32 4}
|
||||
!6 = !{!"clang version 6.0.0 (trunk 313291)"}
|
||||
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
|
||||
!8 = !DISubroutineType(types: !9)
|
||||
!9 = !{!10}
|
||||
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
||||
!11 = !DILocation(line: 2, column: 3, scope: !7)
|
||||
!12 = !DILocation(line: 3, column: 3, scope: !7)
|
||||
!13 = !DILocation(line: 4, column: 3, scope: !7)
|
@ -1,41 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
; ModuleID = 'test-hoist-debug.cpp'
|
||||
source_filename = "test-hoist-debug.cpp"
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: noinline nounwind optnone uwtable
|
||||
define i32 @_Z3foov() !dbg !7 {
|
||||
; CHECK: bitcast
|
||||
; CHECK: !dbg !11
|
||||
; CHECK: inttoptr
|
||||
%a0 = inttoptr i64 4646526064 to i32*, !dbg !11
|
||||
%v0 = load i32, i32* %a0, align 16, !dbg !11
|
||||
|
||||
%a1 = inttoptr i64 4646526080 to i32*
|
||||
%v1 = load i32, i32* %a1, align 16, !dbg !11
|
||||
|
||||
%a2 = inttoptr i64 4646526096 to i32*
|
||||
%v2 = load i32, i32* %a2, align 16, !dbg !11
|
||||
|
||||
%r0 = add i32 %v0, %v1
|
||||
%r1 = add i32 %r0, %v2
|
||||
ret i32 %r1
|
||||
}
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!3, !4, !5}
|
||||
!llvm.ident = !{!6}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 313291)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
||||
!1 = !DIFile(filename: "test-hoist-debug.cpp", directory: "/tmp")
|
||||
!2 = !{}
|
||||
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!5 = !{i32 1, !"wchar_size", i32 4}
|
||||
!6 = !{!"clang version 6.0.0 (trunk 313291)"}
|
||||
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
|
||||
!8 = !DISubroutineType(types: !9)
|
||||
!9 = !{!10}
|
||||
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
||||
!11 = !DILocation(line: 2, column: 3, scope: !7)
|
@ -1,22 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
%T = type { i32, i32, i32, i32 }
|
||||
|
||||
define i32 @test1() nounwind {
|
||||
; CHECK-LABEL: @test1
|
||||
; CHECK: %const = bitcast i32 12345678 to i32
|
||||
; CHECK-NOT: %base = inttoptr i32 12345678 to %T*
|
||||
; CHECK-NEXT: %1 = inttoptr i32 %const to %T*
|
||||
; CHECK-NEXT: %addr1 = getelementptr %T, %T* %1, i32 0, i32 1
|
||||
; CHECK-NEXT: %addr2 = getelementptr %T, %T* %1, i32 0, i32 2
|
||||
; CHECK-NEXT: %addr3 = getelementptr %T, %T* %1, i32 0, i32 3
|
||||
%base = inttoptr i32 12345678 to %T*
|
||||
%addr1 = getelementptr %T, %T* %base, i32 0, i32 1
|
||||
%addr2 = getelementptr %T, %T* %base, i32 0, i32 2
|
||||
%addr3 = getelementptr %T, %T* %base, i32 0, i32 3
|
||||
ret i32 12345678
|
||||
}
|
||||
|
@ -1,70 +0,0 @@
|
||||
; RUN: opt -S -consthoist -consthoist-with-block-frequency=false < %s | FileCheck %s
|
||||
; RUN: opt -S -consthoist -consthoist-with-block-frequency=true < %s | FileCheck --check-prefix=BFIHOIST %s
|
||||
|
||||
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-windows-msvc"
|
||||
|
||||
; CHECK-LABEL: define i32 @main
|
||||
; CHECK: %tobool = icmp eq i32 %argc, 0
|
||||
; CHECK-NEXT: bitcast i64 9209618997431186100 to i64
|
||||
; CHECK-NEXT: br i1 %tobool
|
||||
|
||||
; BFIHOIST-LABEL: define i32 @main
|
||||
; BFIHOIST: then:
|
||||
; BFIHOIST: %[[CONST1:.*]] = bitcast i64 9209618997431186100 to i64
|
||||
; BFIHOIST: %add = add i64 %call4, %[[CONST1]]
|
||||
; BFIHOIST: br label %endif
|
||||
; BFIHOIST: else:
|
||||
; BFIHOIST: %[[CONST2:.*]] = bitcast i64 9209618997431186100 to i64
|
||||
; BFIHOIST: %add6 = add i64 %call5, %[[CONST2]]
|
||||
; BFIHOIST: br label %endif
|
||||
|
||||
; Function Attrs: norecurse
|
||||
define i32 @main(i32 %argc, i8** nocapture readnone %argv) local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
|
||||
%call = tail call i64 @fn(i64 0)
|
||||
%call1 = tail call i64 @fn(i64 1)
|
||||
%tobool = icmp eq i32 %argc, 0
|
||||
br i1 %tobool, label %2, label %1
|
||||
|
||||
; <label>:1: ; preds = %0
|
||||
%call2 = invoke i64 @fn(i64 %call)
|
||||
to label %6 unwind label %catch.dispatch
|
||||
|
||||
; <label>:2: ; preds = %0
|
||||
%call3 = invoke i64 @fn(i64 %call1)
|
||||
to label %6 unwind label %catch.dispatch
|
||||
|
||||
catch.dispatch: ; preds = %2, %1
|
||||
%z.0 = phi i64 [ %call, %1 ], [ %call1, %2 ]
|
||||
%3 = catchswitch within none [label %4] unwind to caller
|
||||
|
||||
; <label>:4: ; preds = %catch.dispatch
|
||||
%5 = catchpad within %3 [i8* null, i32 64, i8* null]
|
||||
br i1 %tobool, label %then, label %else
|
||||
|
||||
then:
|
||||
%call4 = tail call i64 @fn(i64 %z.0) [ "funclet"(token %5) ]
|
||||
%add = add i64 %call4, 9209618997431186100
|
||||
br label %endif
|
||||
|
||||
else:
|
||||
%call5 = tail call i64 @fn(i64 0) [ "funclet"(token %5) ]
|
||||
%add6 = add i64 %call5, 9209618997431186100
|
||||
br label %endif
|
||||
|
||||
endif:
|
||||
%v = phi i64 [ %add, %then ], [ %add6, %else ]
|
||||
%call7 = tail call i64 @fn(i64 %v) [ "funclet"(token %5) ]
|
||||
%call8 = tail call i64 @fn(i64 %call7) [ "funclet"(token %5) ]
|
||||
catchret from %5 to label %6
|
||||
|
||||
; <label>:6: ; preds = %1, %2, %4
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
declare i64 @fn(i64) local_unnamed_addr #1
|
||||
|
||||
declare i32 @__CxxFrameHandler3(...)
|
||||
|
||||
attributes #0 = { norecurse "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
@ -1,36 +0,0 @@
|
||||
; RUN: opt -mtriple=x86_64-darwin-unknown -S -consthoist < %s | FileCheck %s
|
||||
|
||||
define i128 @test1(i128 %a) nounwind {
|
||||
; CHECK-LABEL: test1
|
||||
; CHECK: %const = bitcast i128 12297829382473034410122878 to i128
|
||||
%1 = add i128 %a, 12297829382473034410122878
|
||||
%2 = add i128 %1, 12297829382473034410122878
|
||||
ret i128 %2
|
||||
}
|
||||
|
||||
; Check that we don't hoist the shift value of a shift instruction.
|
||||
define i512 @test2(i512 %a) nounwind {
|
||||
; CHECK-LABEL: test2
|
||||
; CHECK-NOT: %const = bitcast i512 504 to i512
|
||||
%1 = shl i512 %a, 504
|
||||
%2 = ashr i512 %1, 504
|
||||
ret i512 %2
|
||||
}
|
||||
|
||||
; Check that we don't hoist constants with a type larger than i128.
|
||||
define i196 @test3(i196 %a) nounwind {
|
||||
; CHECK-LABEL: test3
|
||||
; CHECK-NOT: %const = bitcast i196 2 to i196
|
||||
%1 = mul i196 %a, 2
|
||||
%2 = mul i196 %1, 2
|
||||
ret i196 %2
|
||||
}
|
||||
|
||||
; Check that we don't hoist immediates with small values.
|
||||
define i96 @test4(i96 %a) nounwind {
|
||||
; CHECK-LABEL: test4
|
||||
; CHECK-NOT: %const = bitcast i96 2 to i96
|
||||
%1 = mul i96 %a, 2
|
||||
%2 = add i96 %1, 2
|
||||
ret i96 %2
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
if not 'X86' in config.root.targets:
|
||||
config.unsupported = True
|
||||
|
@ -1,116 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
; PR18626
|
||||
define i8* @test1(i1 %cmp, i64* %tmp) {
|
||||
entry:
|
||||
call void @foo(i8* inttoptr (i64 68719476735 to i8*))
|
||||
br i1 %cmp, label %if.end, label %return
|
||||
|
||||
if.end: ; preds = %bb1
|
||||
call void @foo(i8* inttoptr (i64 68719476736 to i8*))
|
||||
br label %return
|
||||
|
||||
return:
|
||||
%retval.0 = phi i8* [ null, %entry ], [ inttoptr (i64 68719476736 to i8*), %if.end ]
|
||||
store i64 1172321806, i64* %tmp
|
||||
ret i8* %retval.0
|
||||
|
||||
; CHECK-LABEL: @test1
|
||||
; CHECK: if.end:
|
||||
; CHECK: %2 = inttoptr i64 %const to i8*
|
||||
; CHECK-NEXT: br
|
||||
; CHECK: return:
|
||||
; CHECK-NEXT: %retval.0 = phi i8* [ null, %entry ], [ %2, %if.end ]
|
||||
}
|
||||
|
||||
define void @test2(i1 %cmp, i64** %tmp) {
|
||||
entry:
|
||||
call void @foo(i8* inttoptr (i64 68719476736 to i8*))
|
||||
br i1 %cmp, label %if.end, label %return
|
||||
|
||||
if.end: ; preds = %bb1
|
||||
call void @foo(i8* inttoptr (i64 68719476736 to i8*))
|
||||
br label %return
|
||||
|
||||
return:
|
||||
store i64* inttoptr (i64 68719476735 to i64*), i64** %tmp
|
||||
ret void
|
||||
|
||||
; CHECK-LABEL: @test2
|
||||
; CHECK: return:
|
||||
; CHECK-NEXT: %const_mat = add i64 %const, -1
|
||||
; CHECK-NEXT: inttoptr i64 %const_mat to i64*
|
||||
}
|
||||
|
||||
declare void @foo(i8*)
|
||||
|
||||
; PR18768
|
||||
define i32 @test3(i1 %c) {
|
||||
entry:
|
||||
br i1 %c, label %if.then, label %if.end3
|
||||
|
||||
if.then: ; preds = %entry
|
||||
br label %if.end3
|
||||
|
||||
if.end3: ; preds = %if.then, %entry
|
||||
%d.0 = phi i32* [ inttoptr (i64 985162435264511 to i32*), %entry ], [ null, %if.then ]
|
||||
%cmp4 = icmp eq i32* %d.0, inttoptr (i64 985162435264511 to i32*)
|
||||
%cmp6 = icmp eq i32* %d.0, inttoptr (i64 985162418487296 to i32*)
|
||||
%or = or i1 %cmp4, %cmp6
|
||||
br i1 %or, label %if.then8, label %if.end9
|
||||
|
||||
if.then8: ; preds = %if.end3
|
||||
ret i32 1
|
||||
|
||||
if.end9: ; preds = %if.then8, %if.end3
|
||||
ret i32 undef
|
||||
}
|
||||
|
||||
; <rdar://problem/16394449>
|
||||
define i64 @switch_test1(i64 %a) {
|
||||
; CHECK-LABEL: @switch_test1
|
||||
; CHECK: %0 = phi i64 [ %const, %case2 ], [ %const_mat, %Entry ], [ %const_mat, %Entry ]
|
||||
Entry:
|
||||
%sel = add i64 %a, 4519019440
|
||||
switch i64 %sel, label %fail [
|
||||
i64 462, label %continuation
|
||||
i64 449, label %case2
|
||||
i64 443, label %continuation
|
||||
]
|
||||
|
||||
case2:
|
||||
br label %continuation
|
||||
|
||||
continuation:
|
||||
%0 = phi i64 [ 4519019440, %case2 ], [ 4519019460, %Entry ], [ 4519019460, %Entry ]
|
||||
ret i64 0;
|
||||
|
||||
fail:
|
||||
ret i64 -1;
|
||||
}
|
||||
|
||||
define i64 @switch_test2(i64 %a) {
|
||||
; CHECK-LABEL: @switch_test2
|
||||
; CHECK: %2 = phi i64* [ %1, %case2 ], [ %0, %Entry ], [ %0, %Entry ]
|
||||
Entry:
|
||||
%sel = add i64 %a, 4519019440
|
||||
switch i64 %sel, label %fail [
|
||||
i64 462, label %continuation
|
||||
i64 449, label %case2
|
||||
i64 443, label %continuation
|
||||
]
|
||||
|
||||
case2:
|
||||
br label %continuation
|
||||
|
||||
continuation:
|
||||
%0 = phi i64* [ inttoptr(i64 4519019440 to i64*), %case2 ], [ inttoptr(i64 4519019460 to i64*), %Entry ], [ inttoptr(i64 4519019460 to i64*), %Entry ]
|
||||
ret i64 0;
|
||||
|
||||
fail:
|
||||
ret i64 -1;
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
; RUN: opt -S -consthoist < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
; Test if the 3rd argument of a stackmap is hoisted.
|
||||
define i128 @test1(i128 %a) {
|
||||
; CHECK-LABEL: @test1
|
||||
; CHECK: %const = bitcast i128 134646182756734033220 to i128
|
||||
; CHECK: tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 24, i128 %const)
|
||||
entry:
|
||||
%0 = add i128 %a, 134646182756734033220
|
||||
tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 24, i128 134646182756734033220)
|
||||
ret i128 %0
|
||||
}
|
||||
|
||||
declare void @llvm.experimental.stackmap(i64, i32, ...)
|
Reference in New Issue
Block a user