Skip to content

Commit 3ffe686

Browse files
slinder1David Salinas
authored and
David Salinas
committed
Squashed version of diexpression-poison patches
This is a combination of multiple commits. This is the 1st commit message: DIOp-based DIExpression infrastructure Add the minimal support for DIOp-in-DIExpression, including DIOpFragment and DW_OP_LLVM_poisoned, and the API to differentiate the variants. This is the commit message #2: [Bitcode] Serialization for DIOp-based DIExpression This is the commit message #3: Dwarf generation for DIOp-based DIExpression This is a rather large patch with very minimal testing. It should probably be split up further, and more tests exercising every path are needed. This is the commit message #4: Extend clang option and add clang codegen for DIOp-based DIExpression This is the commit message #5: Support DIOp-based DIExpressions in SROA/mem2reg/instcombine This patch doesn't actually touch those passes, but just the utilities they use, namely createFragmentExpression(), and ConvertDebugDeclareToDebugValue(). This doesn't include assignment tracking, which has some special handling in SROA.cpp and PromoteMemoryToRegister.cpp. We're not planning on using dbg.assign for this (at least for the time being), so I just ignored that for now. This is the commit message #6: [HeterogeneousDwarf] Handle signed integers in DIOpShr and DIOpConvert This commit adds new DI operations to differentiate between a zext/sext DIOpConvert and a ashr/lshr DIOpShr. It isn't possible to use the IR type for this, since it doesn't distinguish between signed and unsigned integers. Fixes SWDEV-466183. This is the commit message #7: [Debugify] Add a flag to make DIOp-based DIExpressions This should be useful for porting debugify-based optimizer tests. Part of SWDEV-462843. This is the commit message #8: Handle new DIOp-DIExpressions in replaceAllDbgUsesWith Fixes part of SWDEV-465029 This is the commit message #9: Handle new DIOp-DIExpressions in salvageDebugInfo This fixes part of SWDEV-465029. This is the commit message #10: [IRGen] Strip addrspacecasts when creating dbg.declares dbg.def does this in DIBuilder, but this commit just adds it to clang to avoid introducing a diff with upstream. This is the commit message #11: Verifier support for DIOp-based DIExpression Effectively a ported and updated version of https://gerrit-git.amd.com/c/lightning/ec/llvm-project/+/974933 Changed to one overload set rather than distinct method names for visitor base so the derived class can opt in to non-exhaustive visiting, rather than it be implied. Added a means to visit the result of the expression when it is otherwise valid (i.e. there is exactly one result). Moved as much of the validation as possible into the base class, leaving the only derived class using the visitor so far to essentially just do bitsize-based type checks when the arguments and/or DataLayout are available. The AsmPrinter support could be ported over to the visitor pattern eventually, and the verifier can be ported over to DIExpr, but these are left as future improvements. This is the commit message #12: Add DIOp AsmPrinter support for Convert/ZExt/SExt Since AsmPrinter currently require values on evaluation stack to be of generic type, we have to use the "legacy" dwarf-4 conversion operations. This can be a little verbose, particularly for sext. It would be technically possible to represent these with three DW_OP_converts (converting generic -> signed FromBits -> signed ToBits -> generic), but using the legacy version seemed simpler. In the future we could use DW_OP_convert to implement these, but in order to do that we would need to ensure that values on the dwarf evaluation stack have non-generic types. For instance, we would need to use use DW_OP_const_type instead of DW_OP_lit for constants. Failing to do so would break binary operators, which require compatible types for their inputs. One note: it seems like it's ambigious whether a DIOpArg that produces a negative signed value with a type smaller than the generic type will have it's higher order bits signed extended or not. For constants, FastISel produces a zero extended value, and non-fast ISel produces a sign extended value (see FastISel.cpp:1263 vs InstrEmitter:740 @ this commit). This can be observed by passing --fast-isel=false to the test file. SExt is correct for both cases, and always creates a fully sign-extended value of the generic type. Fixes SWDEV-467965 This is the commit message #13: Add DIOp-in-DIExpression test for MIR serialization This is the commit message #14: Change -gheterogeneous-dwarf default to diexpression This is the commit message #15: [HeterogeneousDWARF] Various fixes against PSDB Resolve failures in PSDB smoke tests, catch2 tests, and one lit test (caused by upstream work in SROA). Several `FIXME(diexpression-poison)` comments mark places where there is additional work required still, e.g. workarounds or partial fixes to get changes passing PSDB. This is the commit message #16: [HeterogeneousDWARF] Restore -gheterogeneous-dwarf cc1 option This is the commit message #17: [MIR] Replace bespoke DIExpression parser Resolve FIXME by using the LLParser implementation of parseDIExpression from the MIParser. This is the commit message #18: [HetereogeneousDWARF] Revert default to =diexpr Change-Id: I650ec1e9f6f88ef881f79ef3959785439871e0ba
1 parent e90bcf3 commit 3ffe686

File tree

77 files changed

+5390
-826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5390
-826
lines changed

Diff for: clang/include/clang/Basic/CodeGenOptions.def

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ CODEGENOPT(Crel, 1, 0) ///< -Wa,--crel
4040
CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no}
4141
CODEGENOPT(SSE2AVX , 1, 0) ///< -msse2avx
4242
CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm.
43-
CODEGENOPT(HeterogeneousDwarf, 1, 0) ///< Enable DWARF extensions for
44-
///< heterogeneous debugging.
4543
CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments.
4644
CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new
4745
CODEGENOPT(AssumeUniqueVTables , 1, 1) ///< Assume a class has only one vtable.

Diff for: clang/include/clang/Basic/CodeGenOptions.h

+15
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ class CodeGenOptions : public CodeGenOptionsBase {
162162
Never, // No loop is assumed to be finite.
163163
};
164164

165+
enum class HeterogeneousDwarfOpts {
166+
Disabled, //< Do not emit any heterogeneous dwarf metadata.
167+
DIExpr, //< Enable DIExpr-based metadata.
168+
DIExpression, //< Enable DIExpression-based metadata.
169+
};
170+
bool isHeterogeneousDwarfEnabled() const {
171+
return getHeterogeneousDwarfMode() != HeterogeneousDwarfOpts::Disabled;
172+
}
173+
bool isHeterogeneousDwarfDIExpr() const {
174+
return getHeterogeneousDwarfMode() == HeterogeneousDwarfOpts::DIExpr;
175+
}
176+
bool isHeterogeneousDwarfDIExpression() const {
177+
return getHeterogeneousDwarfMode() == HeterogeneousDwarfOpts::DIExpression;
178+
}
179+
165180
enum AssignmentTrackingOpts {
166181
Disabled,
167182
Enabled,

Diff for: clang/include/clang/Basic/DebugOptions.def

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ DEBUGOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
7171
DEBUGOPT(DebugOmitUnreferencedMethods, 1, 0) ///< Omit unreferenced member
7272
///< functions in type debug info.
7373

74+
/// Control DWARF extensions for heterogeneous debugging enablement and approach.
75+
BENIGN_ENUM_DEBUGOPT(HeterogeneousDwarfMode, HeterogeneousDwarfOpts, 2,
76+
HeterogeneousDwarfOpts::Disabled)
77+
7478
/// Control the Assignment Tracking debug info feature.
7579
BENIGN_ENUM_DEBUGOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2,
7680
AssignmentTrackingOpts::Disabled)

Diff for: clang/include/clang/Driver/Options.td

+15-4
Original file line numberDiff line numberDiff line change
@@ -4447,12 +4447,23 @@ def gdwarf64 : Flag<["-"], "gdwarf64">, Group<g_Group>,
44474447
def gdwarf32 : Flag<["-"], "gdwarf32">, Group<g_Group>,
44484448
Visibility<[ClangOption, CC1Option, CC1AsOption]>,
44494449
HelpText<"Enables DWARF32 format for ELF binaries, if debug information emission is enabled.">;
4450-
def gheterogeneous_dwarf : Flag<["-"], "gheterogeneous-dwarf">,
4450+
4451+
def gheterogeneous_dwarf_EQ : Joined<["-"], "gheterogeneous-dwarf=">,
44514452
Group<g_Group>, Visibility<[ClangOption, CC1Option]>,
4452-
HelpText<"Enable DWARF extensions for heterogeneous debugging">,
4453-
MarshallingInfoFlag<CodeGenOpts<"HeterogeneousDwarf">>;
4453+
HelpText<"Control DWARF extensions for heterogeneous debugging">,
4454+
Values<"disabled,diexpr,diexpression">,
4455+
NormalizedValuesScope<"CodeGenOptions::HeterogeneousDwarfOpts">,
4456+
NormalizedValues<["Disabled","DIExpr","DIExpression"]>,
4457+
MarshallingInfoEnum<CodeGenOpts<"HeterogeneousDwarfMode">, "Disabled">;
4458+
def gheterogeneous_dwarf : Flag<["-"], "gheterogeneous-dwarf">, Group<g_Group>,
4459+
Visibility<[ClangOption, CC1Option]>,
4460+
HelpText<"Enable DIExpr-based DWARF extensions for heterogeneous debugging">,
4461+
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["diexpr"]>;
44544462
def gno_heterogeneous_dwarf : Flag<["-"], "gno-heterogeneous-dwarf">,
4455-
Group<g_Group>, HelpText<"Disable DWARF extensions for heterogeneous debugging">;
4463+
Visibility<[ClangOption, CC1Option]>,
4464+
Group<g_Group>,
4465+
HelpText<"Disable DWARF extensions for heterogeneous debugging">,
4466+
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["disabled"]>;
44564467

44574468
def gcodeview : Flag<["-"], "gcodeview">,
44584469
HelpText<"Generate CodeView debug information">,

Diff for: clang/lib/CodeGen/CGDebugInfo.cpp

+153-57
Large diffs are not rendered by default.

Diff for: clang/lib/CodeGen/CGDebugInfo.h

+14-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,20 @@ class CGDebugInfo {
806806
/// anonymous decl and create static variables for them. The first
807807
/// time this is called it needs to be on a union and then from
808808
/// there we can have additional unnamed fields.
809-
llvm::DIGlobalVariable *CollectAnonRecordDeclsForHeterogeneousDwarf(
809+
llvm::DIGlobalVariable *CollectAnonRecordDeclsForHeterogeneousDwarfDIExpr(
810+
const RecordDecl *RD, llvm::DIFile *Unit, unsigned LineNo,
811+
StringRef LinkageName, llvm::dwarf::MemorySpace MS,
812+
llvm::GlobalVariable *Var, llvm::DIScope *DContext);
813+
814+
/// Return a global variable that represents one of the collection of global
815+
/// variables created for an anonmyous union (-gheterogeneous-dwarf).
816+
///
817+
/// Recursively collect all of the member fields of a global
818+
/// anonymous decl and create static variables for them. The first
819+
/// time this is called it needs to be on a union and then from
820+
/// there we can have additional unnamed fields.
821+
llvm::DIGlobalVariableExpression *
822+
CollectAnonRecordDeclsForHeterogeneousDwarfDIExpression(
810823
const RecordDecl *RD, llvm::DIFile *Unit, unsigned LineNo,
811824
StringRef LinkageName, llvm::dwarf::MemorySpace MS,
812825
llvm::GlobalVariable *Var, llvm::DIScope *DContext);

Diff for: clang/lib/CodeGen/CodeGenModule.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ void CodeGenModule::Release() {
10541054
// We support a single version in the linked module. The LLVM
10551055
// parser will drop debug info with a different version number
10561056
// (and warn about it, too).
1057-
if (CodeGenOpts.HeterogeneousDwarf) {
1057+
if (CodeGenOpts.isHeterogeneousDwarfDIExpr()) {
10581058
getModule().addModuleFlag(llvm::Module::Override, "Debug Info Version",
10591059
llvm::DEBUG_METADATA_VERSION_HETEROGENEOUS_DWARF);
10601060
} else {

Diff for: clang/lib/Driver/ToolChains/Clang.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -4834,9 +4834,30 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
48344834
bool EmitDwarfForAMDGCN = EmitDwarf && T.isAMDGCN();
48354835
if (EmitDwarfForAMDGCN)
48364836
CmdArgs.append({"-mllvm", "-amdgpu-spill-cfi-saved-regs"});
4837-
if (Args.hasFlag(options::OPT_gheterogeneous_dwarf,
4838-
options::OPT_gno_heterogeneous_dwarf, EmitDwarfForAMDGCN))
4839-
CmdArgs.push_back("-gheterogeneous-dwarf");
4837+
if (Arg *A = Args.getLastArg(options::OPT_gheterogeneous_dwarf_EQ)) {
4838+
A->render(Args, CmdArgs);
4839+
} else if (EmitDwarfForAMDGCN) {
4840+
#ifndef NDEBUG
4841+
// There doesn't seem to be a straightforward way to "render" an option
4842+
// acquired from the OptTable into a string we can append to CmdArgs.
4843+
// All of the logic is buried in "accept" which works directly in terms
4844+
// of an ArgList.
4845+
//
4846+
// Instead, assert that the static string we are adding to CmdArgs has
4847+
// the same shape as what a bare -gheterogeneous-dwarf would alias to
4848+
// if the user has provided it in ArgList.
4849+
const Option GHeterogeneousDwarf =
4850+
getDriverOptTable().getOption(options::OPT_gheterogeneous_dwarf);
4851+
const Option Aliased = GHeterogeneousDwarf.getAlias();
4852+
assert(Aliased.isValid() && "gheterogeneous-dwarf must be an alias");
4853+
assert(Aliased.getName() == "gheterogeneous-dwarf=" &&
4854+
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=");
4855+
assert(StringRef(GHeterogeneousDwarf.getAliasArgs()) == "diexpr" &&
4856+
GHeterogeneousDwarf.getAliasArgs()[strlen("diexpr") + 1] == '\0' &&
4857+
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=diexpr");
4858+
#endif
4859+
CmdArgs.push_back("-gheterogeneous-dwarf=diexpr");
4860+
}
48404861

48414862
// This controls whether or not we perform JustMyCode instrumentation.
48424863
if (Args.hasFlag(options::OPT_fjmc, options::OPT_fno_jmc, false)) {

Diff for: clang/test/CodeGen/debug-info-block-expr-heterogeneous-dwarf.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gheterogeneous-dwarf -emit-llvm -disable-llvm-verifier -o - %s | FileCheck %s
2-
// RUN: %clang_cc1 -DDEAD_CODE -fblocks -debug-info-kind=limited -gheterogeneous-dwarf -emit-llvm -disable-llvm-verifier -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -emit-llvm -disable-llvm-verifier -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -DDEAD_CODE -fblocks -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -emit-llvm -disable-llvm-verifier -o - %s | FileCheck %s
33

44
typedef void (^BlockTy)();
55
void escapeFunc(BlockTy);

Diff for: clang/test/CodeGen/debug-info-global-constant-heterogeneous-dwarf.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG='&g' -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=INT-ADDROF-VAL %s
2-
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG='&g' -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=INT-ADDROF-NOVAL %s
3-
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG=0 -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=INT-NOADDROF-VAL %s
4-
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG=0 -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=INT-NOADDROF-NOVAL %s
1+
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG='&g' -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=INT-ADDROF-VAL %s
2+
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG='&g' -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=INT-ADDROF-NOVAL %s
3+
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG=0 -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=INT-NOADDROF-VAL %s
4+
// RUN: %clang_cc1 -D ARG_TYPE=int -D PTR_ARG=0 -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=INT-NOADDROF-NOVAL %s
55
//
6-
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG='&g' -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=FLOAT-ADDROF-VAL %s
7-
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG='&g' -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=FLOAT-ADDROF-NOVAL %s
8-
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG=0 -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=FLOAT-NOADDROF-VAL %s
9-
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG=0 -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf %s -o - | FileCheck --check-prefix=FLOAT-NOADDROF-NOVAL %s
6+
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG='&g' -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=FLOAT-ADDROF-VAL %s
7+
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG='&g' -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=FLOAT-ADDROF-NOVAL %s
8+
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG=0 -D VAL_ARG=g -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=FLOAT-NOADDROF-VAL %s
9+
// RUN: %clang_cc1 -D ARG_TYPE=float -D PTR_ARG=0 -D VAL_ARG=0 -emit-llvm -debug-info-kind=standalone -gheterogeneous-dwarf=diexpr %s -o - | FileCheck --check-prefix=FLOAT-NOADDROF-NOVAL %s
1010

1111
// INT-ADDROF-VAL: @g = internal constant i32 1, align 4{{$}}
1212
// INT-ADDROF-VAL-DAG: !llvm.dbg.retainedNodes = !{![[#LIFETIME:]]}

Diff for: clang/test/CodeGen/debug-info-version-heterogeneous-dwarf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -g -gheterogeneous-dwarf -S -emit-llvm -o - %s | FileCheck %s
1+
// RUN: %clang -g -gheterogeneous-dwarf=diexpr -S -emit-llvm -o - %s | FileCheck %s
22
// RUN: %clang -S -emit-llvm -o - %s | FileCheck %s --check-prefix=NO_DEBUG
33
int main (void) {
44
return 0;

Diff for: clang/test/CodeGenCUDA/debug-info-memory-space.cu

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -o - %s | FileCheck %s
22
// CHECK-DAG: !DIGlobalVariable(name: "GlobalShared", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}}, isLocal: false, isDefinition: true, memorySpace: DW_MSPACE_LLVM_group)
33
// CHECK-DAG: !DIGlobalVariable(name: "GlobalDevice", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}}, isLocal: false, isDefinition: true, memorySpace: DW_MSPACE_LLVM_global)
44
// CHECK-DAG: !DIGlobalVariable(name: "GlobalConstant", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}}, isLocal: false, isDefinition: true, memorySpace: DW_MSPACE_LLVM_constant)

Diff for: clang/test/CodeGenCXX/heterogeneous-debug-info-structured-binding-bitfield.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x c++ -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x c++ -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -o - %s | FileCheck %s
22

33
struct S0 {
44
unsigned int x : 16;

Diff for: clang/test/CodeGenCXX/heterogeneous-debug-info-structured-binding.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x c++ -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x c++ -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -o - %s | FileCheck %s
22
//
33
// first def for 'a'
44
// CHECK-LABEL: @_Z1fv()

Diff for: clang/test/CodeGenHIP/debug-info-address-class-heterogeneous-dwarf.hip

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: amdgpu-registered-target
2-
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -o - %s | FileCheck %s
33

44

55
#define __device__ __attribute__((device))

Diff for: clang/test/CodeGenHIP/debug-info-amdgcn-abi-heterogeneous-dwarf.hip

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: amdgpu-registered-target
2-
// RUN: %clang_cc1 -O0 -debug-info-kind=limited -gheterogeneous-dwarf -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -O0 -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -o - %s | FileCheck %s
33

44
// Notes:
55
// * There is no test involving transparent_union, as this isn't supported in

Diff for: clang/test/CodeGenHIP/debug-info-anonymous-union-heterogeneous-dwarf.hip

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: amdgpu-registered-target
2-
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf=diexpr -o - %s | FileCheck %s
33

44
#define __device__ __attribute__((device))
55

Diff for: clang/test/CodeGenHIP/debug-info-cc1-option.hip

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// REQUIRES: amdgpu-registered-target
2+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s
3+
4+
// Check that -gheterogeneous-dwarf without an `=OPTION` suffix remains valid
5+
// and aliases the new default. This is needed for transitioning flang-legacy
6+
// as it depends on the -cc1 interface.
7+
8+
// CHECK: call void @llvm.dbg.def
9+
// CHECK: !DIExpr(
10+
__attribute__((device)) void kernel1(int Arg) {
11+
int FuncVar;
12+
}

0 commit comments

Comments
 (0)