From 74ad441a8001f349194d2c5487d24623784b6cfe Mon Sep 17 00:00:00 2001 From: Lei Huang Date: Mon, 6 Apr 2026 09:21:31 -0400 Subject: [PATCH] Split DWARF v2 tests to exclude 64-bit AIX targets (#189077) 64-bit AIX requires DWARF64 format, which was only introduced in DWARF v3. DWARF v2 only supports 32-bit DWARF format, making it incompatible with 64-bit AIX (the compiler throws a fatal error). These changes split DWARF v2 tests into separate files that exclude 64-bit AIX targets while still running on 32-bit AIX and other 64-bit platforms where DWARF v2 is supported. --- .../DebugInfo/Generic/debug-info-enum-dwarf2.ll | 15 +++++++++++++++ llvm/test/DebugInfo/Generic/debug-info-enum.ll | 6 ++---- .../incorrect-variable-debugloc1-dwarf2.ll | 10 ++++++++++ .../Generic/incorrect-variable-debugloc1.ll | 3 ++- llvm/test/DebugInfo/Generic/restrict-dwarf2.ll | 6 ++++++ llvm/test/DebugInfo/Generic/restrict.ll | 3 ++- 6 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll create mode 100644 llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1-dwarf2.ll create mode 100644 llvm/test/DebugInfo/Generic/restrict-dwarf2.ll diff --git a/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll b/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll new file mode 100644 index 000000000000..d424e1735668 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll @@ -0,0 +1,15 @@ +; Test enumeration representation in DWARF debug info for DWARF v2: +; * test value representation for each possible underlying integer type +; * test the integer type is as expected +; * test the DW_AT_enum_class attribute is present (resp. absent) as expected. +; * test that DW_AT_type is present for v2 when strict DWARF is not enabled. + +; This file contains the dwarf-version=2 tests extracted from debug-info-enum.ll. +; DWARF v2 is incompatible with 64-bit XCOFF/AIX (requires DWARF64 format which needs DWARF v3+). + +; UNSUPPORTED: target=powerpc64{{.*}}-aix{{.*}} + +; RUN: llc -debugger-tune=gdb -dwarf-version=2 -filetype=obj -o %t.o < %S/debug-info-enum.ll +; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %S/debug-info-enum.ll --check-prefixes=CHECK,CHECK-TYPE +; RUN: llc -debugger-tune=gdb -dwarf-version=2 -strict-dwarf=true -filetype=obj -o %t.o < %S/debug-info-enum.ll +; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %S/debug-info-enum.ll --check-prefixes=CHECK,CHECK-DW2-STRICT diff --git a/llvm/test/DebugInfo/Generic/debug-info-enum.ll b/llvm/test/DebugInfo/Generic/debug-info-enum.ll index 9af465d59b7d..67b48eeac035 100644 --- a/llvm/test/DebugInfo/Generic/debug-info-enum.ll +++ b/llvm/test/DebugInfo/Generic/debug-info-enum.ll @@ -9,10 +9,8 @@ ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-DW4,CHECK-TYPE ; RUN: llc -debugger-tune=gdb -dwarf-version=3 -filetype=obj -o %t.o < %s ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-TYPE -; RUN: llc -debugger-tune=gdb -dwarf-version=2 -filetype=obj -o %t.o < %s -; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-TYPE -; RUN: llc -debugger-tune=gdb -dwarf-version=2 -strict-dwarf=true -filetype=obj -o %t.o < %s -; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-DW2-STRICT + +; This file is also used by the dwarf-version=2 tests in debug-info-enum-dwarf2.ll. @x0 = global i8 0, align 1, !dbg !0 @x1 = global i8 0, align 1, !dbg !46 diff --git a/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1-dwarf2.ll b/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1-dwarf2.ll new file mode 100644 index 000000000000..320415cfa135 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1-dwarf2.ll @@ -0,0 +1,10 @@ +; xfail this test on hexagon because at O2, instructions are bundled in packets +; and DW_OP_lit13 is correctly omitted. +; XFAIL: target=hexagon-{{.*}} + +; This file contains the dwarf-version=2 tests extracted from incorrect-variable-debugloc1.ll. +; DWARF v2 is incompatible with 64-bit XCOFF/AIX (requires DWARF64 format which needs DWARF v3+). + +; UNSUPPORTED: target=powerpc64{{.*}}-aix{{.*}} + +; RUN: %llc_dwarf -O2 -dwarf-version 2 -filetype=obj < %S/incorrect-variable-debugloc1.ll | llvm-dwarfdump - | FileCheck %S/incorrect-variable-debugloc1.ll --check-prefix=DWARF23 diff --git a/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll b/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll index 9399eb7a1563..406ab8d86802 100644 --- a/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll +++ b/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll @@ -2,10 +2,11 @@ ; and DW_OP_lit13 is correctly omitted. ; XFAIL: target=hexagon-{{.*}} -; RUN: %llc_dwarf -O2 -dwarf-version 2 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF23 ; RUN: %llc_dwarf -O2 -dwarf-version 3 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF23 ; RUN: %llc_dwarf -O2 -dwarf-version 4 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF4 +; This file is also used by the dwarf-version=2 tests in incorrect-variable-debugloc1-dwarf2.ll. + ; This is a test for PR21176. ; DW_OP_const doesn't describe a constant value, but a value at a constant address. ; The proper way to describe a constant value is DW_OP_constu , DW_OP_stack_value. diff --git a/llvm/test/DebugInfo/Generic/restrict-dwarf2.ll b/llvm/test/DebugInfo/Generic/restrict-dwarf2.ll new file mode 100644 index 000000000000..512573ef2e58 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/restrict-dwarf2.ll @@ -0,0 +1,6 @@ +; This file contains the dwarf-version=2 tests extracted from restrict.ll. +; DWARF v2 is incompatible with 64-bit XCOFF/AIX (requires DWARF64 format which needs DWARF v3+). + +; UNSUPPORTED: target=powerpc64{{.*}}-aix{{.*}} + +; RUN: %llc_dwarf -dwarf-version=2 -O0 -filetype=obj < %S/restrict.ll | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=V2 %S/restrict.ll diff --git a/llvm/test/DebugInfo/Generic/restrict.ll b/llvm/test/DebugInfo/Generic/restrict.ll index f508ec649d30..a47dffc1072b 100644 --- a/llvm/test/DebugInfo/Generic/restrict.ll +++ b/llvm/test/DebugInfo/Generic/restrict.ll @@ -1,6 +1,7 @@ -; RUN: %llc_dwarf -dwarf-version=2 -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=V2 %s ; RUN: %llc_dwarf -dwarf-version=3 -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=V3 %s +; This file is also used by the dwarf-version=2 tests in restrict-dwarf2.ll. + ; CHECK: DW_AT_name ("dst") ; V2: DW_AT_type ([[PTR:0x........]] ; V3: DW_AT_type ([[RESTRICT:0x........]]