Skip to content

Commit

Permalink
[AMDGPU][CodeGenModule] Change module flag behavior to override with …
Browse files Browse the repository at this point in the history
…heterogeneous debug info

When linking modules with differing debug info versions this change sets the linked
module Debug Info version to v4 if at least one module has heterogeneous debug info.
This will ensure the heterogenous verify pass is run on the linked module.

Since modules with v3 will still have warning behavior set, the verifier will both
print a warning and update the module flag to v4 if we have mixed versions.

Change-Id: Ie116df03aa40bb2ba672b25ff1fd032d527faa1c
  • Loading branch information
kerbowa committed Jun 16, 2024
1 parent d4b4156 commit 595afef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,12 +1046,13 @@ void CodeGenModule::Release() {
// We support a single version in the linked module. The LLVM
// parser will drop debug info with a different version number
// (and warn about it, too).
uint32_t DebugMetadataVersion =
CodeGenOpts.HeterogeneousDwarf ?
llvm::DEBUG_METADATA_VERSION_HETEROGENEOUS_DWARF :
llvm::DEBUG_METADATA_VERSION;
getModule().addModuleFlag(llvm::Module::Warning, "Debug Info Version",
DebugMetadataVersion);
if (CodeGenOpts.HeterogeneousDwarf) {
getModule().addModuleFlag(llvm::Module::Override, "Debug Info Version",
llvm::DEBUG_METADATA_VERSION_HETEROGENEOUS_DWARF);
} else {
getModule().addModuleFlag(llvm::Module::Warning, "Debug Info Version",
llvm::DEBUG_METADATA_VERSION);
}
}

// We need to record the widths of enums and wchar_t, so that we can generate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ int main (void) {
return 0;
}

// CHECK: i32 2, !"Debug Info Version", i32 4}
// CHECK: i32 4, !"Debug Info Version", i32 4}
// NO_DEBUG-NOT: !"Debug Info Version"

0 comments on commit 595afef

Please sign in to comment.