brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 264076b Raw
57 lines · plain
1; RUN: llc -start-after=codegenprepare -stop-before=finalize-isel -o - < %s \2; RUN:     -experimental-debug-variable-locations=false \3; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE4; RUN: llc -start-after=codegenprepare -stop-before=finalize-isel -o - < %s \5; RUN:     -experimental-debug-variable-locations=true \6; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF7;8;; Test for correct placement of DBG_VALUE, which in PR40427 is placed before9;; the load instruction it refers to. The circumstance replicated here is where10;; two instructions in a row, trunc and add, begin with no-op Copy{To,From}Reg11;; SDNodes that produce no instructions.12;; The DBG_VALUE instruction should come immediately after the load instruction13;; because the truncate is optimised out, and the DBG_VALUE should be placed14;; in front of the first instruction that occurs after the dbg.value.15;16 17; CHECK: ![[DBGVAR:[0-9]+]] = !DILocalVariable(name: "bees",18 19target triple = "x86_64-unknown-linux-gnu"20 21define i16 @lolwat(i1 %spoons, ptr %bees, i16 %yellow, ptr %more) {22entry:23  br i1 %spoons, label %trueb, label %falseb24trueb:25  br label %block26falseb:27  br label %block28block:29; CHECK:      [[PHIREG:%[0-9]+]]:gr64 = PHI %6, %bb.2, %4, %bb.130; CHECK-NEXT: [[LOADR:%[0-9]+]]:gr16 = MOV16rm %0,31; INSTRREF-SAME: debug-instr-number 132; DBGVALUE-NEXT: DBG_VALUE [[LOADR]], $noreg, ![[DBGVAR]]33; INSTRREF-NEXT: DBG_INSTR_REF ![[DBGVAR]], {{.+}}, dbg-instr-ref(1, 0)34; CHECK-NEXT: %{{[0-9]+}}:gr32 = IMPLICIT_DEF35  %foo = phi ptr[%bees, %trueb], [%more, %falseb]36  %ret = load i32, ptr %foo, !dbg !637  %cast = trunc i32 %ret to i16, !dbg !638  call void @llvm.dbg.value(metadata i16 %cast, metadata !1, metadata !DIExpression()), !dbg !639  %orly2 = add i16 %yellow, 140  br label %bb141bb1:42  %cheese = add i16 %orly2, %cast43  ret i16 %cheese, !dbg !644}45 46declare void @llvm.dbg.value(metadata, metadata, metadata)47 48!llvm.module.flags = !{!4}49!llvm.dbg.cu = !{!2}50!1 = !DILocalVariable(name: "bees", scope: !5, type: null)51!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "beards", isOptimized: true, runtimeVersion: 4, emissionKind: FullDebug)52!3 = !DIFile(filename: "bees.cpp", directory: "")53!4 = !{i32 2, !"Debug Info Version", i32 3}54!5 = distinct !DISubprogram(name: "nope", scope: !2, file: !3, line: 1, unit: !2)55!6 = !DILocation(line: 0, scope: !5)56!7 = !DILocalVariable(name: "flannel", scope: !5, type: null)57