blob: aa04837431cd211f21fa6418f675d4ec25b5223d [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -p=reassociate -S < %s | FileCheck %s
;; Tests that when we reassociate %add93, we apply its debug location to the new
;; instructions.
define void @foo(i32 %0) {
; CHECK-LABEL: define void @foo(
; CHECK-SAME: i32 [[TMP0:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: br label %[[FOR_COND23:.*]]
; CHECK: [[FOR_COND23]]:
; CHECK-NEXT: [[SUB59:%.*]] = sub i32 0, 0
; CHECK-NEXT: [[MUL68:%.*]] = mul i32 0, [[TMP0]]
; CHECK-NEXT: [[REASS_ADD:%.*]] = add i32 [[MUL68]], [[TMP0]], !dbg [[DBG3:![0-9]+]]
; CHECK-NEXT: [[REASS_MUL1:%.*]] = mul i32 [[REASS_ADD]], [[SUB59]], !dbg [[DBG3]]
; CHECK-NEXT: [[REASS_MUL:%.*]] = add i32 [[REASS_MUL1]], 1, !dbg [[DBG3]]
; CHECK-NEXT: [[CONV95:%.*]] = trunc i32 [[REASS_MUL]] to i16
; CHECK-NEXT: store i16 [[CONV95]], ptr null, align 2
; CHECK-NEXT: br label %[[FOR_COND23]]
;
entry:
br label %for.cond23
for.cond23: ; preds = %for.cond23, %entry
%sub59 = sub i32 0, 0
%mul62 = mul i32 %sub59, %0
%mul68 = mul i32 %mul62, 0
%mul77 = mul i32 %sub59, %0
%add84 = or i32 %mul68, %mul77
%add93 = add i32 %add84, 1, !dbg !4
%conv95 = trunc i32 %add93 to i16
store i16 %conv95, ptr null, align 2
br label %for.cond23
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3}
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 20.0.0git")
!1 = !DIFile(filename: "test.c", directory: "/tmp")
!2 = !{}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !DILocation(line: 15, column: 50, scope: !5)
!5 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 14, type: !6, scopeLine: 14, unit: !0, retainedNodes: !2)
!6 = distinct !DISubroutineType(types: !7)
!7 = !{null}
;.
; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
; CHECK: [[META1]] = !DIFile(filename: "test.c", directory: {{.*}})
; CHECK: [[DBG3]] = !DILocation(line: 15, column: 50, scope: [[META4:![0-9]+]])
; CHECK: [[META4]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 14, type: [[META5:![0-9]+]], scopeLine: 14, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META7:![0-9]+]])
; CHECK: [[META5]] = distinct !DISubroutineType(types: [[META6:![0-9]+]])
; CHECK: [[META6]] = !{null}
; CHECK: [[META7]] = !{}
;.