hip-pinned-shadow global var should remain in the final code object irrespective
of whether it is used or not within the code. Add it to used list, so that it
will not get eliminated when it is unused.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
the assertion in addUsedGlobal should not be removed. that will remove the guard for potential bugs
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
1918–1921 | This check should be removed completely instead it should be revised for the exceptions. |
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
1918–1921 | How about add back this assertion but make an exception for global variables with hip_pinned_shadow attribute. |
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
1918–1921 | Yeah, that is what I was thinking of initially - to remove this assertion only to hip_pinned_shadow vars, may, be creating a clone of this function something like - CodeGenModule::addUsedGlobalForHipPinnedShadows(), without assertion statement. What do you say? |
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
1918–1921 | how about change that function prototype to void addUsedGlobal(llvm::GlobalValue *GV, bool SkipCheck = false) and assert check to assert ((SkipCheck || !GV->isDeclaration()) && ""); |
BTW, why that variable cannot have an initializer? Suppose that initializer is a trivial one, initializing to 0, would that cause any issue in the compilation?
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
1918–1921 | This also looks fine to me, and I can make these changes and submit the changes. |
Initialization makes the global extern var declaration to become a global definition. And. moreover, it is not a new change from my side, I just happen to add a comment.
This kind of variable is supposed to be an external variable which is initialized by runtime at run time.
This check should be removed completely instead it should be revised for the exceptions.