forked from OSchip/llvm-project
[CodeGen] Avoid some pointer element type accesses
This commit is contained in:
parent
e7007b69d4
commit
b9492ec649
|
@ -4648,13 +4648,13 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
//
|
||||
// In other cases, we assert that the types match up (until pointers stop
|
||||
// having pointee types).
|
||||
llvm::Type *TypeFromVal;
|
||||
if (Callee.isVirtual())
|
||||
TypeFromVal = Callee.getVirtualFunctionType();
|
||||
else
|
||||
TypeFromVal =
|
||||
Callee.getFunctionPointer()->getType()->getPointerElementType();
|
||||
assert(IRFuncTy == TypeFromVal);
|
||||
assert(IRFuncTy == Callee.getVirtualFunctionType());
|
||||
else {
|
||||
llvm::PointerType *PtrTy =
|
||||
llvm::cast<llvm::PointerType>(Callee.getFunctionPointer()->getType());
|
||||
assert(PtrTy->isOpaqueOrPointeeTypeMatches(IRFuncTy));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ public:
|
|||
AbstractInfo = abstractInfo;
|
||||
assert(functionPtr && "configuring callee without function pointer");
|
||||
assert(functionPtr->getType()->isPointerTy());
|
||||
assert(functionPtr->getType()->getPointerElementType()->isFunctionTy());
|
||||
assert(functionPtr->getType()->isOpaquePointerTy() ||
|
||||
functionPtr->getType()->getPointerElementType()->isFunctionTy());
|
||||
}
|
||||
|
||||
static CGCallee forBuiltin(unsigned builtinID,
|
||||
|
|
|
@ -1146,7 +1146,7 @@ Address CodeGenModule::createUnnamedGlobalFrom(const VarDecl &D,
|
|||
CacheEntry->setAlignment(Align.getAsAlign());
|
||||
}
|
||||
|
||||
return Address(CacheEntry, Align);
|
||||
return Address(CacheEntry, CacheEntry->getValueType(), Align);
|
||||
}
|
||||
|
||||
static Address createUnnamedGlobalForMemcpyFrom(CodeGenModule &CGM,
|
||||
|
|
|
@ -3697,7 +3697,7 @@ static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr,
|
|||
idx, DbgInfo);
|
||||
}
|
||||
|
||||
return Address(eltPtr, eltAlign);
|
||||
return Address(eltPtr, CGF.ConvertTypeForMem(eltType), eltAlign);
|
||||
}
|
||||
|
||||
LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
|
||||
|
|
Loading…
Reference in New Issue