mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-01 01:31:26 +00:00
[OpenMP] Fix non-determinism in clang copyin codegen
Codegen for OpeMP copyin has non-deterministic IR output due to the unspecified evaluation order in a codegen conditional branch, which makes automatic test generation unreliable. This patch refactors codegen code to avoid this non-determinism. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D101952
This commit is contained in:
parent
7b73cd684a
commit
f97b843d88
@ -1006,12 +1006,14 @@ bool CodeGenFunction::EmitOMPCopyinClause(const OMPExecutableDirective &D) {
|
||||
// need to copy data.
|
||||
CopyBegin = createBasicBlock("copyin.not.master");
|
||||
CopyEnd = createBasicBlock("copyin.not.master.end");
|
||||
// TODO: Avoid ptrtoint conversion.
|
||||
auto *MasterAddrInt =
|
||||
Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
|
||||
auto *PrivateAddrInt =
|
||||
Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
|
||||
Builder.CreateCondBr(
|
||||
Builder.CreateICmpNE(
|
||||
Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
|
||||
Builder.CreatePtrToInt(PrivateAddr.getPointer(),
|
||||
CGM.IntPtrTy)),
|
||||
CopyBegin, CopyEnd);
|
||||
Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
|
||||
CopyEnd);
|
||||
EmitBlock(CopyBegin);
|
||||
}
|
||||
const auto *SrcVD =
|
||||
|
Loading…
Reference in New Issue
Block a user