diff options
author | Nikita Popov <npopov@redhat.com> | 2023-07-18 11:28:13 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-07-18 11:31:41 +0200 |
commit | 8db30225ecc433fd02b623bc4789904930892eb7 (patch) | |
tree | aaf495d6879258b5adc3c5ae4b9467a5062d8a91 /llvm/lib | |
parent | fe705c3426b4ea30d210465553862628b07300b1 (diff) | |
download | llvm-8db30225ecc433fd02b623bc4789904930892eb7.zip llvm-8db30225ecc433fd02b623bc4789904930892eb7.tar.gz llvm-8db30225ecc433fd02b623bc4789904930892eb7.tar.bz2 |
[OpenMPIRBuilder] Check GV type instead of pointee type (NFC)
Change the assertion to check the value type instead of the pointee
type. To facilitate this, store GlobalVariable* instead of Constant*
in the map.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index 1b28372..4c3696f 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -4410,8 +4410,7 @@ OpenMPIRBuilder::getOrCreateInternalVariable(Type *Ty, const StringRef &Name, unsigned AddressSpace) { auto &Elem = *InternalVars.try_emplace(Name, nullptr).first; if (Elem.second) { - assert(cast<PointerType>(Elem.second->getType()) - ->isOpaqueOrPointeeTypeMatches(Ty) && + assert(Elem.second->getValueType() == Ty && "OMP internal variable has different type than requested"); } else { // TODO: investigate the appropriate linkage type used for the global @@ -4426,7 +4425,7 @@ OpenMPIRBuilder::getOrCreateInternalVariable(Type *Ty, const StringRef &Name, Elem.second = GV; } - return cast<GlobalVariable>(&*Elem.second); + return Elem.second; } Value *OpenMPIRBuilder::getOMPCriticalRegionLock(StringRef CriticalName) { |