[llvm] r245642 - Further reduce the IR in this testcase based on a further reduction
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 16:59:40 PDT 2015
Author: adrian
Date: Thu Aug 20 18:59:39 2015
New Revision: 245642
URL: http://llvm.org/viewvc/llvm-project?rev=245642&view=rev
Log:
Further reduce the IR in this testcase based on a further reduction
of the original source by David Blaikie (thanks!).
Modified:
llvm/trunk/test/DebugInfo/gvn.ll
Modified: llvm/trunk/test/DebugInfo/gvn.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/gvn.ll?rev=245642&r1=245641&r2=245642&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/gvn.ll (original)
+++ llvm/trunk/test/DebugInfo/gvn.ll Thu Aug 20 18:59:39 2015
@@ -1,80 +1,63 @@
-; RUN: opt < %s -O2 -gvn -S | FileCheck %s
+; RUN: opt < %s -gvn -S | FileCheck %s
;
; Produced at -O2 from:
-; struct context {
-; int cur_pid
-; };
-; int a, b, c, f, d;
-; int pid_for_task(int);
-; sample(struct context *p1)
-; {
-; if (c)
-; b = a;
-; if (a && p1->cur_pid)
-; sample_internal();
+; int a, b;
+; void f1(int *p1) {
+; if (b)
+; a = 1;
+; if (a && *p1)
+; f4();
; }
-; callback() {
-; f = pid_for_task(d);
-; sample(&f);
+; int f2(int);
+; void f3(void) {
+; a = f2(1);
+; f1(&a);
; }
-
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios"
-%struct.context = type { i32 }
-
- at c = common global i32 0, align 4
@a = common global i32 0, align 4
@b = common global i32 0, align 4
- at d = common global i32 0, align 4
- at f = common global i32 0, align 4
; Function Attrs: nounwind
declare i32 @sample_internal(...)
; Function Attrs: nounwind
-define i32 @callback() #0 {
+define void @f3() #0 {
entry:
- %0 = load i32, i32* @d, align 4, !dbg !37
-
; Verify that the call still has a debug location after GVN.
- ; CHECK: %call = tail call i32 @pid_for_task(i32 %0) #{{[0-9]}}, !dbg
- %call = tail call i32 @pid_for_task(i32 %0) #3, !dbg !37
-
- store i32 %call, i32* @f, align 4, !dbg !37
- tail call void @llvm.dbg.value(metadata %struct.context* bitcast (i32* @f to %struct.context*), i64 0, metadata !25, metadata !26) #3, !dbg !38
- %1 = load i32, i32* @c, align 4, !dbg !40
- %tobool.i = icmp eq i32 %1, 0, !dbg !40
- %.pr.i = load i32, i32* @a, align 4, !dbg !41
- br i1 %tobool.i, label %if.end.i, label %if.then.i, !dbg !42
-
-if.then.i: ; preds = %entry
- store i32 %.pr.i, i32* @b, align 4, !dbg !43
- br label %if.end.i, !dbg !43
-
-if.end.i: ; preds = %if.then.i, %entry
- %tobool1.i = icmp eq i32 %.pr.i, 0, !dbg !41
+ ; CHECK: %call = tail call i32 @f2(i32 1) #{{[0-9]}}, !dbg
+ %call = tail call i32 @f2(i32 1) #3, !dbg !36
+ store i32 %call, i32* @a, align 4, !dbg !36, !tbaa !25
+ tail call void @llvm.dbg.value(metadata i32* @a, i64 0, metadata !11, metadata !21) #3, !dbg !39
+ %0 = load i32, i32* @b, align 4, !dbg !39, !tbaa !25
+ %tobool.i = icmp eq i32 %0, 0, !dbg !39
+ br i1 %tobool.i, label %if.end.i, label %land.lhs.true.i.thread, !dbg !40
+
+land.lhs.true.i.thread: ; preds = %entry
+ store i32 1, i32* @a, align 4, !dbg !41, !tbaa !25
+ br label %if.then.3.i, !dbg !42
+if.end.i: ; preds = %entry
; This instruction has no debug location -- in this
; particular case it was removed by a bug in SimplifyCFG.
- %2 = load i32, i32* @f, align 4
+ %.pr = load i32, i32* @a, align 4
- ; GVN is supposed to replace the load of @f with a direct reference to %call.
+ ; GVN is supposed to replace the load of %.pr with a direct reference to %call.
; CHECK: %tobool2.i = icmp eq i32 %call, 0, !dbg
- %tobool2.i = icmp eq i32 %2, 0, !dbg !41
-
- %or.cond = or i1 %tobool1.i, %tobool2.i, !dbg !41
- br i1 %or.cond, label %sample.exit, label %if.then.3.i, !dbg !41
+ %tobool2.i = icmp eq i32 %.pr, 0, !dbg !43
+ br i1 %tobool2.i, label %f1.exit, label %if.then.3.i, !dbg !43
-if.then.3.i: ; preds = %if.end.i
- %call.i = tail call i32 bitcast (i32 (...)* @sample_internal to i32 ()*)() #3, !dbg !44
- br label %sample.exit, !dbg !44
+if.then.3.i: ; preds = %if.end.i, %land.lhs.true.i.thread
+ %call.i = tail call i32 bitcast (i32 (...)* @f4 to i32 ()*)() #3, !dbg !44
+ br label %f1.exit, !dbg !44
-sample.exit: ; preds = %if.end.i, %if.then.3.i
- ret i32 undef, !dbg !45
+f1.exit: ; preds = %if.end.i, %if.then.3.i
+ ret void, !dbg !45
}
-declare i32 @pid_for_task(i32) #1
+declare i32 @f2(i32)
+declare i32 @f4(...)
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
@@ -84,52 +67,51 @@ attributes #2 = { nounwind readnone }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!22, !23}
-!llvm.ident = !{!24}
+!llvm.module.flags = !{!18, !19}
+!llvm.ident = !{!20}
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 244473) (llvm/trunk 244644)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3, globals: !16)
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 245562) (llvm/trunk 245569)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3, globals: !15)
!1 = !DIFile(filename: "test.c", directory: "/")
!2 = !{}
-!3 = !{!4, !13}
-!4 = !DISubprogram(name: "sample", scope: !5, file: !5, line: 6, type: !6, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!5 = !DIFile(filename: "test.i", directory: "/")
+!3 = !{!4, !12}
+!4 = !DISubprogram(name: "f1", scope: !1, file: !1, line: 2, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, variables: !10)
!6 = !DISubroutineType(types: !7)
-!7 = !{!8, !9}
-!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 64)
-!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "context", file: !5, line: 1, size: 32, align: 32, elements: !11)
-!11 = !{!12}
-!12 = !DIDerivedType(tag: DW_TAG_member, name: "cur_pid", scope: !10, file: !5, line: 2, baseType: !8, size: 32, align: 32)
-!13 = !DISubprogram(name: "callback", scope: !5, file: !5, line: 13, type: !14, isLocal: false, isDefinition: true, scopeLine: 13, isOptimized: false, function: i32 ()* @callback, variables: !2)
-!14 = !DISubroutineType(types: !15)
-!15 = !{!8}
-!16 = !{!17, !18, !19, !20, !21}
-!17 = !DIGlobalVariable(name: "a", scope: !0, file: !5, line: 4, type: !8, isLocal: false, isDefinition: true, variable: i32* @a)
-!18 = !DIGlobalVariable(name: "b", scope: !0, file: !5, line: 4, type: !8, isLocal: false, isDefinition: true, variable: i32* @b)
-!19 = !DIGlobalVariable(name: "c", scope: !0, file: !5, line: 4, type: !8, isLocal: false, isDefinition: true, variable: i32* @c)
-!20 = !DIGlobalVariable(name: "f", scope: !0, file: !5, line: 4, type: !8, isLocal: false, isDefinition: true, variable: i32* @f)
-!21 = !DIGlobalVariable(name: "d", scope: !0, file: !5, line: 4, type: !8, isLocal: false, isDefinition: true, variable: i32* @d)
-!22 = !{i32 2, !"Dwarf Version", i32 2}
-!23 = !{i32 2, !"Debug Info Version", i32 3}
-!24 = !{!"clang version 3.8.0 (trunk 244473) (llvm/trunk 244644)"}
-!25 = !DILocalVariable(name: "p1", arg: 1, scope: !4, file: !5, line: 6, type: !9)
-!26 = !DIExpression()
-!27 = !DILocation(line: 6, scope: !4)
-!28 = !DILocation(line: 8, scope: !29)
-!29 = distinct !DILexicalBlock(scope: !4, file: !5, line: 8)
-!30 = !DILocation(line: 10, scope: !31)
-!31 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10)
-!32 = !DILocation(line: 8, scope: !4)
-!33 = !DILocation(line: 9, scope: !29)
-!34 = !DILocation(line: 10, scope: !4)
-!35 = !DILocation(line: 11, scope: !31)
-!36 = !DILocation(line: 12, scope: !4)
-!37 = !DILocation(line: 14, scope: !13)
-!38 = !DILocation(line: 6, scope: !4, inlinedAt: !39)
-!39 = distinct !DILocation(line: 15, scope: !13)
-!40 = !DILocation(line: 8, scope: !29, inlinedAt: !39)
-!41 = !DILocation(line: 10, scope: !31, inlinedAt: !39)
-!42 = !DILocation(line: 8, scope: !4, inlinedAt: !39)
-!43 = !DILocation(line: 9, scope: !29, inlinedAt: !39)
-!44 = !DILocation(line: 11, scope: !31, inlinedAt: !39)
-!45 = !DILocation(line: 16, scope: !13)
+!7 = !{null, !8}
+!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64)
+!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+!10 = !{!11}
+!11 = !DILocalVariable(name: "p1", arg: 1, scope: !4, file: !1, line: 2, type: !8)
+!12 = !DISubprogram(name: "f3", scope: !1, file: !1, line: 9, type: !13, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, function: void ()* @f3, variables: !2)
+!13 = !DISubroutineType(types: !14)
+!14 = !{null}
+!15 = !{!16, !17}
+!16 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i32* @a)
+!17 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i32* @b)
+!18 = !{i32 2, !"Dwarf Version", i32 2}
+!19 = !{i32 2, !"Debug Info Version", i32 3}
+!20 = !{!"clang version 3.8.0 (trunk 245562) (llvm/trunk 245569)"}
+!21 = !DIExpression()
+!22 = !DILocation(line: 2, scope: !4)
+!23 = !DILocation(line: 3, scope: !24)
+!24 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3)
+!25 = !{!26, !26, i64 0}
+!26 = !{!"int", !27, i64 0}
+!27 = !{!"omnipotent char", !28, i64 0}
+!28 = !{!"Simple C/C++ TBAA"}
+!29 = !DILocation(line: 3, scope: !4)
+!30 = !DILocation(line: 4, scope: !24)
+!31 = !DILocation(line: 5, scope: !32)
+!32 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5)
+!33 = !DILocation(line: 5, scope: !4)
+!34 = !DILocation(line: 6, scope: !32)
+!35 = !DILocation(line: 7, scope: !4)
+!36 = !DILocation(line: 5, scope: !32, inlinedAt: !37)
+!37 = distinct !DILocation(line: 11, scope: !12)
+!38 = !DILocation(line: 10, scope: !12)
+!39 = !DILocation(line: 2, scope: !4, inlinedAt: !37)
+!40 = !DILocation(line: 3, scope: !24, inlinedAt: !37)
+!41 = !DILocation(line: 3, scope: !4, inlinedAt: !37)
+!42 = !DILocation(line: 4, scope: !24, inlinedAt: !37)
+!43 = !DILocation(line: 5, scope: !4, inlinedAt: !37)
+!44 = !DILocation(line: 6, scope: !32, inlinedAt: !37)
+!45 = !DILocation(line: 12, scope: !12)
More information about the llvm-commits
mailing list