Change the assertion to check the value type instead of the pointee
type. To facilitate this, store GlobalVariable* instead of Constant*
in the map.
/// <critical_section_name> + ".var" for "omp critical" directives; 2)
/// <mangled_name_for_global_var> + ".cache." for cache for threadprivate
/// variables.
- StringMap<Constant*, BumpPtrAllocator> InternalVars;
+ StringMap<GlobalVariable *, BumpPtrAllocator> InternalVars;
/// Computes the size of type in bytes.
Value *getSizeInBytes(Value *BasePtr);
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
Elem.second = GV;
}
- return cast<GlobalVariable>(&*Elem.second);
+ return Elem.second;
}
Value *OpenMPIRBuilder::getOMPCriticalRegionLock(StringRef CriticalName) {