xref: /llvm-project/llvm/test/Transforms/LICM/sinking-debugify.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes='debugify,function(loop-mssa(licm))' -S | FileCheck %s
3; RUN: opt < %s -passes='debugify,function(loop-mssa(licm))' -S --try-experimental-debuginfo-iterators | FileCheck %s
4
5%Ty = type { i32, i32 }
6@X2 = external global %Ty
7
8; The GEP in dead1 is adding a zero offset, so the DIExpression can be kept as
9; a "register location".
10; The GEP in dead2 is adding a 4 bytes to the pointer, so the DIExpression is
11; turned into an "implicit location" using DW_OP_stack_value.
12define void @test11() {
13; CHECK-LABEL: @test11(
14; CHECK-NEXT:    br label [[LOOP:%.*]], !dbg [[DBG11:![0-9]+]]
15; CHECK:       Loop:
16; CHECK-NEXT:      #dbg_value(ptr @X2, [[META9:![0-9]+]], !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value), [[META12:![0-9]+]])
17; CHECK-NEXT:    br i1 false, label [[LOOP]], label [[OUT:%.*]], !dbg [[DBG13:![0-9]+]]
18; CHECK:       Out:
19; CHECK-NEXT:    ret void, !dbg [[DBG14:![0-9]+]]
20;
21  br label %Loop
22Loop:
23  %dead2 = getelementptr %Ty, ptr @X2, i64 0, i32 1
24  br i1 false, label %Loop, label %Out
25Out:
26  ret void
27}
28