summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InferFunctionAttrs
diff options
context:
space:
mode:
authorChristian Bruel <christian.bruel@st.com>2018-12-05 16:48:00 +0000
committerChristian Bruel <christian.bruel@st.com>2018-12-05 16:48:00 +0000
commit4ead99b3ac2a0ccd5174c35bcf339eb080dd9697 (patch)
tree699e96567456f2052354c47527f7d17714a13234 /llvm/test/Transforms/InferFunctionAttrs
parent3998bebc1268982750473528a22297807cb9bce3 (diff)
downloadbcm5719-llvm-4ead99b3ac2a0ccd5174c35bcf339eb080dd9697.tar.gz
bcm5719-llvm-4ead99b3ac2a0ccd5174c35bcf339eb080dd9697.zip
Allow norecurse attribute on functions that have debug infos.
Summary: debug intrinsics might be marked norecurse to enable the caller function to be norecurse and optimized if needed. This avoids code gen optimisation differences when -g is used, as in globalOpt.cpp:processInternalGlobal checks. Reviewers: chandlerc, jmolloy, aprantl Reviewed By: aprantl Subscribers: aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D55187 llvm-svn: 348381
Diffstat (limited to 'llvm/test/Transforms/InferFunctionAttrs')
-rw-r--r--llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll56
1 files changed, 56 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll b/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
new file mode 100644
index 00000000000..575bbac5e5a
--- /dev/null
+++ b/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
@@ -0,0 +1,56 @@
+; RUN: opt < %s -O2 -S | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "armv4t-none-unknown-eabi"
+
+@foo.coefficient1 = internal unnamed_addr global i32* null, align 4, !dbg !0
+@iirLow1 = external dso_local local_unnamed_addr global i32*, align 4
+
+; Function Attrs: nounwind
+define dso_local void @foo(i32 %i2) local_unnamed_addr #0 !dbg !2 {
+entry:
+ call void @llvm.dbg.value(metadata i32 %i2, metadata !11, metadata !DIExpression()), !dbg !18
+ %0 = load i32*, i32** @iirLow1, align 4, !dbg !19
+ store i32 0, i32* %0, align 4, !dbg !24
+ %1 = ptrtoint i32* %0 to i32, !dbg !27
+ store i32 %1, i32* bitcast (i32** @foo.coefficient1 to i32*), align 4, !dbg !28
+ ret void, !dbg !29
+}
+
+; Function Attrs: nounwind readnone speculatable
+declare void @llvm.dbg.value(metadata, metadata, metadata) #1
+
+attributes #0 = { nounwind }
+attributes #1 = { nounwind readnone speculatable }
+
+!llvm.dbg.cu = !{!7}
+!llvm.module.flags = !{!13, !14, !15, !16}
+!llvm.ident = !{!17}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "coefficient1", scope: !2, file: !3, line: 5, type: !12, isLocal: true, isDefinition: true)
+!2 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 3, type: !4, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !7, retainedNodes: !10)
+!3 = !DIFile(filename: "norecurse_debug.c", directory: "/")
+!4 = !DISubroutineType(types: !5)
+!5 = !{null, !6}
+!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!7 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !8, globals: !9, nameTableKind: None)
+!8 = !{}
+!9 = !{!0}
+!10 = !{!11}
+!11 = !DILocalVariable(name: "i2", arg: 1, scope: !2, file: !3, line: 3, type: !6)
+!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 32)
+!13 = !{i32 2, !"Dwarf Version", i32 4}
+!14 = !{i32 2, !"Debug Info Version", i32 3}
+!15 = !{i32 1, !"wchar_size", i32 4}
+!16 = !{i32 1, !"min_enum_size", i32 4}
+!17 = !{!""}
+!18 = !DILocation(line: 3, column: 14, scope: !2)
+!19 = !DILocation(line: 7, column: 6, scope: !2)
+!24 = !DILocation(line: 7, column: 14, scope: !2)
+!27 = !DILocation(line: 9, column: 20, scope: !2)
+!28 = !DILocation(line: 9, column: 18, scope: !2)
+!29 = !DILocation(line: 10, column: 1, scope: !2)
+
+; CHECK: attributes #0 = { norecurse nounwind }
+; CHECK-NOT foo.coefficient1
OpenPOWER on IntegriCloud