brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 084c449 Raw
112 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt -passes=gvn -S < %s | FileCheck %s --check-prefixes=CHECK,MDEP3; RUN: opt -passes='gvn<memoryssa>' -S < %s | FileCheck %s --check-prefixes=CHECK,MSSA4 5target datalayout = "e-p:64:64:64"6 7 8 9@G = external global [100 x i32]10define i32 @foo(i32 %x, i32 %z) !dbg !6 {11; MDEP-LABEL: define i32 @foo(12; MDEP-SAME: i32 [[X:%.*]], i32 [[Z:%.*]]) !dbg [[DBG5:![0-9]+]] {13; MDEP-NEXT:  [[ENTRY:.*:]]14; MDEP-NEXT:    [[TOBOOL:%.*]] = icmp eq i32 [[Z]], 0, !dbg [[DBG8:![0-9]+]]15; MDEP-NEXT:    br i1 [[TOBOOL]], label %[[ENTRY_END_CRIT_EDGE:.*]], label %[[THEN:.*]], !dbg [[DBG8]]16; MDEP:       [[ENTRY_END_CRIT_EDGE]]:17; MDEP-NEXT:    [[J_PHI_TRANS_INSERT:%.*]] = sext i32 [[X]] to i6418; MDEP-NEXT:    [[Q_PHI_TRANS_INSERT:%.*]] = getelementptr [100 x i32], ptr @G, i64 0, i64 [[J_PHI_TRANS_INSERT]]19; MDEP-NEXT:    [[N_PRE:%.*]] = load i32, ptr [[Q_PHI_TRANS_INSERT]], align 4, !dbg [[DBG9:![0-9]+]]20; MDEP-NEXT:    br label %[[END:.*]], !dbg [[DBG8]]21; MDEP:       [[THEN]]:22; MDEP-NEXT:    [[I:%.*]] = sext i32 [[X]] to i64, !dbg [[DBG10:![0-9]+]]23; MDEP-NEXT:    [[P:%.*]] = getelementptr [100 x i32], ptr @G, i64 0, i64 [[I]], !dbg [[DBG10]]24; MDEP-NEXT:    store i32 [[Z]], ptr [[P]], align 4, !dbg [[DBG10]]25; MDEP-NEXT:    br label %[[END]], !dbg [[DBG10]]26; MDEP:       [[END]]:27; MDEP-NEXT:    [[J_PRE_PHI:%.*]] = phi i64 [ [[J_PHI_TRANS_INSERT]], %[[ENTRY_END_CRIT_EDGE]] ], [ [[I]], %[[THEN]] ], !dbg [[DBG11:![0-9]+]]28; MDEP-NEXT:    [[N:%.*]] = phi i32 [ [[N_PRE]], %[[ENTRY_END_CRIT_EDGE]] ], [ [[Z]], %[[THEN]] ], !dbg [[DBG9]]29; MDEP-NEXT:    [[Q:%.*]] = getelementptr [100 x i32], ptr @G, i64 0, i64 [[J_PRE_PHI]], !dbg [[DBG12:![0-9]+]]30; MDEP-NEXT:    ret i32 [[N]], !dbg [[DBG9]]31;32; MSSA-LABEL: define i32 @foo(33; MSSA-SAME: i32 [[X:%.*]], i32 [[Z:%.*]]) !dbg [[DBG5:![0-9]+]] {34; MSSA-NEXT:  [[ENTRY:.*:]]35; MSSA-NEXT:    [[TOBOOL:%.*]] = icmp eq i32 [[Z]], 0, !dbg [[DBG8:![0-9]+]]36; MSSA-NEXT:    br i1 [[TOBOOL]], label %[[ENTRY_END_CRIT_EDGE:.*]], label %[[THEN:.*]], !dbg [[DBG8]]37; MSSA:       [[ENTRY_END_CRIT_EDGE]]:38; MSSA-NEXT:    [[DOTPRE:%.*]] = sext i32 [[X]] to i64, !dbg [[DBG9:![0-9]+]]39; MSSA-NEXT:    br label %[[END:.*]], !dbg [[DBG8]]40; MSSA:       [[THEN]]:41; MSSA-NEXT:    [[I:%.*]] = sext i32 [[X]] to i64, !dbg [[DBG10:![0-9]+]]42; MSSA-NEXT:    [[P:%.*]] = getelementptr [100 x i32], ptr @G, i64 0, i64 [[I]], !dbg [[DBG10]]43; MSSA-NEXT:    store i32 [[Z]], ptr [[P]], align 4, !dbg [[DBG10]]44; MSSA-NEXT:    br label %[[END]], !dbg [[DBG10]]45; MSSA:       [[END]]:46; MSSA-NEXT:    [[J_PRE_PHI:%.*]] = phi i64 [ [[DOTPRE]], %[[ENTRY_END_CRIT_EDGE]] ], [ [[I]], %[[THEN]] ], !dbg [[DBG9]]47; MSSA-NEXT:    [[Q:%.*]] = getelementptr [100 x i32], ptr @G, i64 0, i64 [[J_PRE_PHI]], !dbg [[DBG11:![0-9]+]]48; MSSA-NEXT:    [[N:%.*]] = load i32, ptr [[Q]], align 4, !dbg [[DBG12:![0-9]+]]49; MSSA-NEXT:    ret i32 [[N]], !dbg [[DBG12]]50;51entry:52  %tobool = icmp eq i32 %z, 0, !dbg !753  br i1 %tobool, label %end, label %then, !dbg !754 55then:56  %i = sext i32 %x to i64, !dbg !857  %p = getelementptr [100 x i32], ptr @G, i64 0, i64 %i, !dbg !858  store i32 %z, ptr %p, !dbg !859  br label %end, !dbg !860 61end:62  %j = sext i32 %x to i64, !dbg !963  %q = getelementptr [100 x i32], ptr @G, i64 0, i64 %j, !dbg !1064  %n = load i32, ptr %q, !dbg !1165  ret i32 %n, !dbg !1166}67 68!llvm.module.flags = !{!0, !1, !2}69!llvm.dbg.cu = !{!12}70!0 = !{i32 2, !"Dwarf Version", i32 4}71!1 = !{i32 2, !"Debug Info Version", i32 3}72!2 = !{i32 1, !"PIC Level", i32 2}73 74!3 = !{}75!4 = !DISubroutineType(types: !3)76!5 = !DIFile(filename: "a.cc", directory: "/tmp")77!6 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 42, type: !4, isLocal: false, isDefinition: true, scopeLine: 43, flags: DIFlagPrototyped, isOptimized: false, unit: !12, retainedNodes: !3)78!7 = !DILocation(line: 43, column: 1, scope: !6)79!8 = !DILocation(line: 44, column: 1, scope: !6)80!9 = !DILocation(line: 45, column: 1, scope: !6)81!10 = !DILocation(line: 46, column: 1, scope: !6)82!11 = !DILocation(line: 47, column: 1, scope: !6)83!12 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",84  file: !5,85  isOptimized: true, flags: "-O2",86  splitDebugFilename: "abc.debug", emissionKind: 2)87;.88; MDEP: [[META3:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META4:![0-9]+]], producer: "clang", isOptimized: true, flags: "-O2", runtimeVersion: 0, splitDebugFilename: "abc.debug", emissionKind: LineTablesOnly)89; MDEP: [[META4]] = !DIFile(filename: "{{.*}}a.cc", directory: {{.*}})90; MDEP: [[DBG5]] = distinct !DISubprogram(name: "foo", scope: [[META4]], file: [[META4]], line: 42, type: [[META6:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META3]], retainedNodes: [[META7:![0-9]+]])91; MDEP: [[META6]] = !DISubroutineType(types: [[META7]])92; MDEP: [[META7]] = !{}93; MDEP: [[DBG8]] = !DILocation(line: 43, column: 1, scope: [[DBG5]])94; MDEP: [[DBG9]] = !DILocation(line: 47, column: 1, scope: [[DBG5]])95; MDEP: [[DBG10]] = !DILocation(line: 44, column: 1, scope: [[DBG5]])96; MDEP: [[DBG11]] = !DILocation(line: 45, column: 1, scope: [[DBG5]])97; MDEP: [[DBG12]] = !DILocation(line: 46, column: 1, scope: [[DBG5]])98;.99; MSSA: [[META3:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META4:![0-9]+]], producer: "clang", isOptimized: true, flags: "-O2", runtimeVersion: 0, splitDebugFilename: "abc.debug", emissionKind: LineTablesOnly)100; MSSA: [[META4]] = !DIFile(filename: "{{.*}}a.cc", directory: {{.*}})101; MSSA: [[DBG5]] = distinct !DISubprogram(name: "foo", scope: [[META4]], file: [[META4]], line: 42, type: [[META6:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META3]], retainedNodes: [[META7:![0-9]+]])102; MSSA: [[META6]] = !DISubroutineType(types: [[META7]])103; MSSA: [[META7]] = !{}104; MSSA: [[DBG8]] = !DILocation(line: 43, column: 1, scope: [[DBG5]])105; MSSA: [[DBG9]] = !DILocation(line: 45, column: 1, scope: [[DBG5]])106; MSSA: [[DBG10]] = !DILocation(line: 44, column: 1, scope: [[DBG5]])107; MSSA: [[DBG11]] = !DILocation(line: 46, column: 1, scope: [[DBG5]])108; MSSA: [[DBG12]] = !DILocation(line: 47, column: 1, scope: [[DBG5]])109;.110;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:111; CHECK: {{.*}}112