summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/SampleProfile/Inputs/einline.prof3
-rw-r--r--llvm/test/Transforms/SampleProfile/early-inline.ll47
2 files changed, 50 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/einline.prof b/llvm/test/Transforms/SampleProfile/Inputs/einline.prof
new file mode 100644
index 00000000000..425d6ce22c1
--- /dev/null
+++ b/llvm/test/Transforms/SampleProfile/Inputs/einline.prof
@@ -0,0 +1,3 @@
+_Z3foov:200:100
+ 1: _Z3barv:100
+ 3: _Z3barv:100
diff --git a/llvm/test/Transforms/SampleProfile/early-inline.ll b/llvm/test/Transforms/SampleProfile/early-inline.ll
new file mode 100644
index 00000000000..1ec16119e52
--- /dev/null
+++ b/llvm/test/Transforms/SampleProfile/early-inline.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/einline.prof | FileCheck %s
+
+; Checks if both call and invoke can be inlined early if their inlined
+; instances are hot in profile.
+
+target triple = "x86_64-unknown-linux-gnu"
+
+@_ZTIi = external constant i8*
+
+; Function Attrs: uwtable
+define void @_Z3foov() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !dbg !6 {
+ %1 = alloca i8*
+ %2 = alloca i32
+ %3 = alloca i32, align 4
+; CHECK-NOT: call
+ call void @_ZL3barv(), !dbg !9
+; CHECK-NOT: invoke
+ invoke void @_ZL3barv()
+ to label %4 unwind label %5, !dbg !10
+
+; <label>:4:
+ ret void
+
+; <label>:5:
+ %6 = landingpad { i8*, i32 }
+ catch i8* bitcast (i8** @_ZTIi to i8*)
+ ret void
+}
+
+; Function Attrs: nounwind uwtable
+define internal void @_ZL3barv() #1 {
+ ret void
+}
+
+declare i32 @__gxx_personality_v0(...)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
+!1 = !DIFile(filename: "a", directory: "b/")
+!3 = !{i32 2, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!6 = distinct !DISubprogram(linkageName: "_Z3foov", scope: !1, line: 5, scopeLine: 5, unit: !0)
+!9 = !DILocation(line: 6, column: 3, scope: !6)
+!10 = !DILocation(line: 8, column: 5, scope: !11)
+!11 = distinct !DILexicalBlock(scope: !6, file: !1, line: 7, column: 7)
OpenPOWER on IntegriCloud