brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 094467e Raw
73 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 62; RUN: opt -passes=gvn -S < %s | FileCheck %s3 4; Check that the redundant load from %if.then is removed.5; Also, check that the debug location associated to load %0 still refers to6; line 3 and not line 6.7 8target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"9 10define i32 @test_redundant_load(i32 %X, ptr %Y) !dbg !6 {11; CHECK-LABEL: define i32 @test_redundant_load(12; CHECK-SAME: i32 [[X:%.*]], ptr [[Y:%.*]]) !dbg [[DBG6:![0-9]+]] {13; CHECK-NEXT:  [[ENTRY:.*]]:14; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[Y]], align 4, !dbg [[DBG8:![0-9]+]]15; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[X]], -1, !dbg [[DBG9:![0-9]+]]16; CHECK-NEXT:    br i1 [[CMP]], label %[[IF_THEN:.*]], label %[[IF_END:.*]], !dbg [[DBG9]]17; CHECK:       [[IF_THEN]]:18; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP0]], !dbg [[DBG10:![0-9]+]]19; CHECK-NEXT:    call void @foo(), !dbg [[DBG11:![0-9]+]]20; CHECK-NEXT:    br label %[[IF_END]], !dbg [[DBG12:![0-9]+]]21; CHECK:       [[IF_END]]:22; CHECK-NEXT:    [[RESULT_0:%.*]] = phi i32 [ [[ADD]], %[[IF_THEN]] ], [ [[TMP0]], %[[ENTRY]] ]23; CHECK-NEXT:    ret i32 [[RESULT_0]], !dbg [[DBG13:![0-9]+]]24;25entry:26  %0 = load i32, ptr %Y, align 4, !dbg !827  %cmp = icmp sgt i32 %X, -1, !dbg !928  br i1 %cmp, label %if.then, label %if.end, !dbg !929 30if.then:                                          ; preds = %entry31  %1 = load i32, ptr %Y, align 4, !dbg !1032  %add = add nsw i32 %0, %1, !dbg !1033  call void @foo(), !dbg !1134  br label %if.end, !dbg !1235 36if.end:                                           ; preds = %if.then, %entry37  %Result.0 = phi i32 [ %add, %if.then ], [ %0, %entry ]38  ret i32 %Result.0, !dbg !1339}40 41declare void @foo()42 43!llvm.dbg.cu = !{!0}44!llvm.module.flags = !{!3, !4, !5}45 46!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)47!1 = !DIFile(filename: "test.cpp", directory: "")48!2 = !{}49!3 = !{i32 2, !"Dwarf Version", i32 4}50!4 = !{i32 2, !"Debug Info Version", i32 3}51!5 = !{i32 1, !"PIC Level", i32 2}52!6 = distinct !DISubprogram(name: "test_redundant_load", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)53!7 = !DISubroutineType(types: !2)54!8 = !DILocation(line: 3, scope: !6)55!9 = !DILocation(line: 5, scope: !6)56!10 = !DILocation(line: 6, scope: !6)57!11 = !DILocation(line: 7, scope: !6)58!12 = !DILocation(line: 8, scope: !6)59!13 = !DILocation(line: 10, scope: !6)60;.61; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: [[META2:![0-9]+]])62; CHECK: [[META1]] = !DIFile(filename: "test.cpp", directory: "")63; CHECK: [[META2]] = !{}64; CHECK: [[DBG6]] = distinct !DISubprogram(name: "test_redundant_load", scope: [[META1]], file: [[META1]], line: 2, type: [[META7:![0-9]+]], scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META2]])65; CHECK: [[META7]] = !DISubroutineType(types: [[META2]])66; CHECK: [[DBG8]] = !DILocation(line: 3, scope: [[DBG6]])67; CHECK: [[DBG9]] = !DILocation(line: 5, scope: [[DBG6]])68; CHECK: [[DBG10]] = !DILocation(line: 6, scope: [[DBG6]])69; CHECK: [[DBG11]] = !DILocation(line: 7, scope: [[DBG6]])70; CHECK: [[DBG12]] = !DILocation(line: 8, scope: [[DBG6]])71; CHECK: [[DBG13]] = !DILocation(line: 10, scope: [[DBG6]])72;.73