[clang] [CUDA] Emit used function list in deterministic order. (PR #102661)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 11:53:07 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Artem Belevich (Artem-B)
<details>
<summary>Changes</summary>
Fixes https://github.com/llvm/llvm-project/issues/101560
---
Full diff: https://github.com/llvm/llvm-project/pull/102661.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+3)
``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 9aaf90ccfe04ff..aefedeffab614a 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -950,6 +950,9 @@ void CodeGenModule::Release() {
UsedArray.push_back(llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
GetAddrOfGlobal(GD), Int8PtrTy));
}
+ // Sort decls by name to always emit them in deterministic order.
+ llvm::sort(UsedArray,
+ [](auto A, auto B) { return A->getName() < B->getName(); });
llvm::ArrayType *ATy = llvm::ArrayType::get(Int8PtrTy, UsedArray.size());
``````````
</details>
https://github.com/llvm/llvm-project/pull/102661
More information about the cfe-commits
mailing list