[PATCH] D149162: [Clang][OpenMP][IRBuilder] Move registerTargetGlobalVariable & getAddrOfDeclareTargetVar into the OMPIRBuilder
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 20 14:18:26 PDT 2023
MaskRay added a comment.
In D149162#4517500 <https://reviews.llvm.org/D149162#4517500>, @MaskRay wrote:
> `registerTargetGlobalVariable` relies on the iteration order of StringMap, which is not guaranteed. The bug is caught by D155789 <https://reviews.llvm.org/D155789>
>
> curl -L 'https://reviews.llvm.org/D155789?download=1' | patch -p1
> cmake ... -DLLVM_ENABLE_REVERSE_ITERATION=on
> ninja -C ... check-llvm-unit # `LLVM-Unit :: Frontend/./LLVMFrontendTests/OpenMPIRBuilderTest/registerTargetGlobalVariable` fails
Looks like the issue might be introduced by 03f270c900e1f8563419fdd302683a9503e98722 in the iteration order of `OffloadEntriesDeviceGlobalVarTy OffloadEntriesDeviceGlobalVar` (a StringMap).
Unfortunately, changing it to `MapVector<StringRef, OffloadEntryInfoDeviceGlobalVar>` will break other tests like `clang/test/OpenMP/declare_target_codegen.cpp`, which suggests that there are other weird iteration order dependent behavior.
Hopefully someone familiar with OpenMP can investigate :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149162/new/
https://reviews.llvm.org/D149162
More information about the cfe-commits
mailing list