brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · f784c10 Raw
94 lines · plain
1; RUN: opt -S -loop-reduce < %s | FileCheck %s2 3; During Loop Strength Reduce, if the terminating condition for the loop is not4; immediately adjacent to the terminating branch and it has more than one use,5; a clone of the condition will be created just before the terminating branch6; and will be used as the branch condition.7; The purpose of this test is to check that the presence of a debug intrinsic8; between the condition and branch does not trigger this behaviour, as this9; would cause debug info to affect CodeGen.10 11; CHECK-LABEL: i:12; CHECK-NOT: icmp13; CHECK: [[COND:%.*]] = icmp eq i814; CHECK-NEXT: #dbg_value(i1 [[COND]]15; CHECK-NEXT: br i1 [[COND]]16 17 18target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"19target triple = "x86_64-unknown-linux-gnu"20 21@b = dso_local local_unnamed_addr global i8 0, align 1, !dbg !022@a = dso_local local_unnamed_addr global i32 0, align 4, !dbg !623@c = dso_local local_unnamed_addr global i8 0, align 1, !dbg !924define dso_local signext i16 @d() local_unnamed_addr !dbg !17 {25entry:26  %0 = load i32, ptr @a, align 427  %tobool2.not = icmp eq i32 %0, 028  %1 = load i8, ptr @b, align 1, !dbg !2429  %cmp.not13 = icmp eq i8 %1, 7, !dbg !2430  br i1 %cmp.not13, label %cleanup, label %if.end.preheader, !dbg !2431 32if.end.preheader:                                 ; preds = %entry33  br label %if.end, !dbg !2434 35if.end:                                           ; preds = %if.end.preheader, %i36  %2 = phi i8 [ %add, %i ], [ %1, %if.end.preheader ]37  br i1 %tobool2.not, label %i, label %if.end4, !dbg !2438 39if.end4:                                          ; preds = %if.end40  %conv5 = trunc i32 %0 to i16, !dbg !2441  br label %cleanup, !dbg !2442 43i:                                                ; preds = %if.end44  %add = add i8 %2, 1, !dbg !2445  store i8 %add, ptr @b, align 1, !dbg !2446  %cmp.not = icmp eq i8 %add, 7, !dbg !2447  call void @llvm.dbg.value(metadata i1 %cmp.not, metadata !23, metadata !DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_stack_value)), !dbg !2448  br i1 %cmp.not, label %cleanup.loopexit, label %if.end, !dbg !2449 50cleanup.loopexit:                                 ; preds = %i51  br label %cleanup52 53cleanup:                                          ; preds = %cleanup.loopexit, %if.end4, %entry54  %cmp.not12 = phi i1 [ %cmp.not13, %if.end4 ], [ %cmp.not13, %entry ], [ %cmp.not, %cleanup.loopexit ]55  %retval.0 = phi i16 [ %conv5, %if.end4 ], [ undef, %entry ], [ undef, %cleanup.loopexit ]56  %3 = load i8, ptr @c, align 157  %conv8 = sext i8 %3 to i1658  %retval.1 = select i1 %cmp.not12, i16 %conv8, i16 %retval.059  ret i16 %retval.1, !dbg !2460}61 62declare void @llvm.dbg.value(metadata, metadata, metadata)63 64!llvm.dbg.cu = !{!2}65!llvm.module.flags = !{!12, !13, !14, !15}66!llvm.ident = !{!16}67 68!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())69!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 2, type: !11, isLocal: false, isDefinition: true)70!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 13.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)71!3 = !DIFile(filename: "lsr-cond-dbg.c", directory: "/")72!4 = !{}73!5 = !{!6, !0, !9}74!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())75!7 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !8, isLocal: false, isDefinition: true)76!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)77!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())78!10 = distinct !DIGlobalVariable(name: "c", scope: !2, file: !3, line: 2, type: !11, isLocal: false, isDefinition: true)79!11 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)80!12 = !{i32 7, !"Dwarf Version", i32 4}81!13 = !{i32 2, !"Debug Info Version", i32 3}82!14 = !{i32 1, !"wchar_size", i32 4}83!15 = !{i32 7, !"uwtable", i32 1}84!16 = !{!"clang version 13.0.0"}85!17 = distinct !DISubprogram(name: "d", scope: !3, file: !3, line: 3, type: !18, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !21)86!18 = !DISubroutineType(types: !19)87!19 = !{!20}88!20 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)89!21 = !{!23}90!22 = distinct !DILexicalBlock(scope: !17, file: !3, line: 4, column: 3)91!23 = !DILocalVariable(name: "g", scope: !22, file: !3, line: 7, type: !8)92!24 = !DILocation(line: 5, column: 9, scope: !22)93 94