From: Nikita Popov Date: Tue, 18 Jul 2023 09:28:13 +0000 (+0200) Subject: [OpenMPIRBuilder] Check GV type instead of pointee type (NFC) X-Git-Tag: upstream/17.0.6~1387 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8db30225ecc433fd02b623bc4789904930892eb7;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 011f472..fc83876 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -1469,7 +1469,7 @@ public: /// + ".var" for "omp critical" directives; 2) /// + ".cache." for cache for threadprivate /// variables. - StringMap InternalVars; + StringMap InternalVars; /// Computes the size of type in bytes. Value *getSizeInBytes(Value *BasePtr); 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(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(&*Elem.second); + return Elem.second; } Value *OpenMPIRBuilder::getOMPCriticalRegionLock(StringRef CriticalName) {