Skip to content

Commit fb9a741

Browse files
Alex Gateacebowler
authored andcommitted
[CodeGen][NFCI] Avoid calls to setTargetAttributes on definitions
Avoid duplicate calls to setTargetAttributes on global variable definitions. Differential: https://reviews.llvm.org/D153903
1 parent 3c30179 commit fb9a741

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4765,7 +4765,8 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty,
47654765
}
47664766
}
47674767

4768-
if (GV->isDeclaration()) {
4768+
if (D &&
4769+
D->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly) {
47694770
getTargetCodeGenInfo().setTargetAttributes(D, GV, *this);
47704771
// External HIP managed variables needed to be recorded for transformation
47714772
// in both device and host compilations.

0 commit comments

Comments
 (0)