Skip to content

Commit f2f33aa

Browse files
slinder1kzhuravl
authored andcommitted
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 c6ce536 commit f2f33aa

File tree

82 files changed

+6000
-1267
lines changed

Some content is hidden

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

82 files changed

+6000
-1267
lines changed

clang/include/clang/Basic/CodeGenOptions.def

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ CODEGENOPT(Name, Bits, Default)
3030
CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
3131
CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no}
3232
CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm.
33-
CODEGENOPT(HeterogeneousDwarf, 1, 0) ///< Enable DWARF extensions for
34-
///< heterogeneous debugging.
3533
CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments.
3634
CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new
3735
CODEGENOPT(AssumeUniqueVTables , 1, 1) ///< Assume a class has only one vtable.

clang/include/clang/Basic/CodeGenOptions.h

+15
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,21 @@ class CodeGenOptions : public CodeGenOptionsBase {
158158
Never, // No loop is assumed to be finite.
159159
};
160160

161+
enum class HeterogeneousDwarfOpts {
162+
Disabled, //< Do not emit any heterogeneous dwarf metadata.
163+
DIExpr, //< Enable DIExpr-based metadata.
164+
DIExpression, //< Enable DIExpression-based metadata.
165+
};
166+
bool isHeterogeneousDwarfEnabled() const {
167+
return getHeterogeneousDwarfMode() != HeterogeneousDwarfOpts::Disabled;
168+
}
169+
bool isHeterogeneousDwarfDIExpr() const {
170+
return getHeterogeneousDwarfMode() == HeterogeneousDwarfOpts::DIExpr;
171+
}
172+
bool isHeterogeneousDwarfDIExpression() const {
173+
return getHeterogeneousDwarfMode() == HeterogeneousDwarfOpts::DIExpression;
174+
}
175+
161176
enum AssignmentTrackingOpts {
162177
Disabled,
163178
Enabled,

clang/include/clang/Basic/DebugOptions.def

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ BENIGN_DEBUGOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
6969

7070
DEBUGOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
7171

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

clang/include/clang/Driver/Options.td

+15-4
Original file line numberDiff line numberDiff line change
@@ -4211,12 +4211,23 @@ def gdwarf64 : Flag<["-"], "gdwarf64">, Group<g_Group>,
42114211
def gdwarf32 : Flag<["-"], "gdwarf32">, Group<g_Group>,
42124212
Visibility<[ClangOption, CC1Option, CC1AsOption]>,
42134213
HelpText<"Enables DWARF32 format for ELF binaries, if debug information emission is enabled.">;
4214-
def gheterogeneous_dwarf : Flag<["-"], "gheterogeneous-dwarf">,
4214+
4215+
def gheterogeneous_dwarf_EQ : Joined<["-"], "gheterogeneous-dwarf=">,
42154216
Group<g_Group>, Visibility<[ClangOption, CC1Option]>,
4216-
HelpText<"Enable DWARF extensions for heterogeneous debugging">,
4217-
MarshallingInfoFlag<CodeGenOpts<"HeterogeneousDwarf">>;
4217+
HelpText<"Control DWARF extensions for heterogeneous debugging">,
4218+
Values<"disabled,diexpr,diexpression">,
4219+
NormalizedValuesScope<"CodeGenOptions::HeterogeneousDwarfOpts">,
4220+
NormalizedValues<["Disabled","DIExpr","DIExpression"]>,
4221+
MarshallingInfoEnum<CodeGenOpts<"HeterogeneousDwarfMode">, "Disabled">;
4222+
def gheterogeneous_dwarf : Flag<["-"], "gheterogeneous-dwarf">, Group<g_Group>,
4223+
Visibility<[ClangOption, CC1Option]>,
4224+
HelpText<"Enable DIExpr-based DWARF extensions for heterogeneous debugging">,
4225+
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["diexpr"]>;
42184226
def gno_heterogeneous_dwarf : Flag<["-"], "gno-heterogeneous-dwarf">,
4219-
Group<g_Group>, HelpText<"Disable DWARF extensions for heterogeneous debugging">;
4227+
Visibility<[ClangOption, CC1Option]>,
4228+
Group<g_Group>,
4229+
HelpText<"Disable DWARF extensions for heterogeneous debugging">,
4230+
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["disabled"]>;
42204231

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

clang/lib/CodeGen/CGDebugInfo.cpp

+152-56
Large diffs are not rendered by default.

clang/lib/CodeGen/CGDebugInfo.h

+14-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,20 @@ class CGDebugInfo {
777777
/// anonymous decl and create static variables for them. The first
778778
/// time this is called it needs to be on a union and then from
779779
/// there we can have additional unnamed fields.
780-
llvm::DIGlobalVariable *CollectAnonRecordDeclsForHeterogeneousDwarf(
780+
llvm::DIGlobalVariable *CollectAnonRecordDeclsForHeterogeneousDwarfDIExpr(
781+
const RecordDecl *RD, llvm::DIFile *Unit, unsigned LineNo,
782+
StringRef LinkageName, llvm::dwarf::MemorySpace MS,
783+
llvm::GlobalVariable *Var, llvm::DIScope *DContext);
784+
785+
/// Return a global variable that represents one of the collection of global
786+
/// variables created for an anonmyous union (-gheterogeneous-dwarf).
787+
///
788+
/// Recursively collect all of the member fields of a global
789+
/// anonymous decl and create static variables for them. The first
790+
/// time this is called it needs to be on a union and then from
791+
/// there we can have additional unnamed fields.
792+
llvm::DIGlobalVariableExpression *
793+
CollectAnonRecordDeclsForHeterogeneousDwarfDIExpression(
781794
const RecordDecl *RD, llvm::DIFile *Unit, unsigned LineNo,
782795
StringRef LinkageName, llvm::dwarf::MemorySpace MS,
783796
llvm::GlobalVariable *Var, llvm::DIScope *DContext);

clang/lib/CodeGen/CodeGenModule.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ void CodeGenModule::Release() {
985985
// We support a single version in the linked module. The LLVM
986986
// parser will drop debug info with a different version number
987987
// (and warn about it, too).
988-
if (CodeGenOpts.HeterogeneousDwarf) {
988+
if (CodeGenOpts.isHeterogeneousDwarfDIExpr()) {
989989
getModule().addModuleFlag(llvm::Module::Override, "Debug Info Version",
990990
llvm::DEBUG_METADATA_VERSION_HETEROGENEOUS_DWARF);
991991
} else {

clang/lib/Driver/ToolChains/Clang.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -4590,9 +4590,30 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
45904590
bool EmitDwarfForAMDGCN = EmitDwarf && T.isAMDGCN();
45914591
if (EmitDwarfForAMDGCN)
45924592
CmdArgs.append({"-mllvm", "-amdgpu-spill-cfi-saved-regs"});
4593-
if (Args.hasFlag(options::OPT_gheterogeneous_dwarf,
4594-
options::OPT_gno_heterogeneous_dwarf, EmitDwarfForAMDGCN))
4595-
CmdArgs.push_back("-gheterogeneous-dwarf");
4593+
if (Arg *A = Args.getLastArg(options::OPT_gheterogeneous_dwarf_EQ)) {
4594+
A->render(Args, CmdArgs);
4595+
} else if (EmitDwarfForAMDGCN) {
4596+
#ifndef NDEBUG
4597+
// There doesn't seem to be a straightforward way to "render" an option
4598+
// acquired from the OptTable into a string we can append to CmdArgs.
4599+
// All of the logic is buried in "accept" which works directly in terms
4600+
// of an ArgList.
4601+
//
4602+
// Instead, assert that the static string we are adding to CmdArgs has
4603+
// the same shape as what a bare -gheterogeneous-dwarf would alias to
4604+
// if the user has provided it in ArgList.
4605+
const Option GHeterogeneousDwarf =
4606+
getDriverOptTable().getOption(options::OPT_gheterogeneous_dwarf);
4607+
const Option Aliased = GHeterogeneousDwarf.getAlias();
4608+
assert(Aliased.isValid() && "gheterogeneous-dwarf must be an alias");
4609+
assert(Aliased.getName() == "gheterogeneous-dwarf=" &&
4610+
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=");
4611+
assert(StringRef(GHeterogeneousDwarf.getAliasArgs()) == "diexpr" &&
4612+
GHeterogeneousDwarf.getAliasArgs()[strlen("diexpr") + 1] == '\0' &&
4613+
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=diexpr");
4614+
#endif
4615+
CmdArgs.push_back("-gheterogeneous-dwarf=diexpr");
4616+
}
45964617

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

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);

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:]]}

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;

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)

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;

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()

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))

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

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

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)