[CodeGen] Remove an unnecessary cast (NFC) (#146380)
E is already of Expr * and shares the same declaration among all these cases.
This commit is contained in:
parent
529508c187
commit
efc561c061
@ -2440,7 +2440,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
||||
case CK_BlockPointerToObjCPointerCast:
|
||||
case CK_AnyPointerToBlockPointerCast:
|
||||
case CK_BitCast: {
|
||||
Value *Src = Visit(const_cast<Expr*>(E));
|
||||
Value *Src = Visit(E);
|
||||
llvm::Type *SrcTy = Src->getType();
|
||||
llvm::Type *DstTy = ConvertType(DestTy);
|
||||
|
||||
@ -2606,11 +2606,10 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
||||
case CK_AtomicToNonAtomic:
|
||||
case CK_NonAtomicToAtomic:
|
||||
case CK_UserDefinedConversion:
|
||||
return Visit(const_cast<Expr*>(E));
|
||||
return Visit(E);
|
||||
|
||||
case CK_NoOp: {
|
||||
return CE->changesVolatileQualification() ? EmitLoadOfLValue(CE)
|
||||
: Visit(const_cast<Expr *>(E));
|
||||
return CE->changesVolatileQualification() ? EmitLoadOfLValue(CE) : Visit(E);
|
||||
}
|
||||
|
||||
case CK_BaseToDerived: {
|
||||
@ -2712,10 +2711,10 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
||||
case CK_LValueToRValue:
|
||||
assert(CGF.getContext().hasSameUnqualifiedType(E->getType(), DestTy));
|
||||
assert(E->isGLValue() && "lvalue-to-rvalue applied to r-value!");
|
||||
return Visit(const_cast<Expr*>(E));
|
||||
return Visit(E);
|
||||
|
||||
case CK_IntegralToPointer: {
|
||||
Value *Src = Visit(const_cast<Expr*>(E));
|
||||
Value *Src = Visit(E);
|
||||
|
||||
// First, convert to the correct width so that we control the kind of
|
||||
// extension.
|
||||
@ -2768,7 +2767,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
||||
case CK_HLSLAggregateSplatCast:
|
||||
case CK_VectorSplat: {
|
||||
llvm::Type *DstTy = ConvertType(DestTy);
|
||||
Value *Elt = Visit(const_cast<Expr *>(E));
|
||||
Value *Elt = Visit(E);
|
||||
// Splat the element across to all elements
|
||||
llvm::ElementCount NumElements =
|
||||
cast<llvm::VectorType>(DstTy)->getElementCount();
|
||||
@ -2906,7 +2905,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
||||
case CK_HLSLVectorTruncation: {
|
||||
assert((DestTy->isVectorType() || DestTy->isBuiltinType()) &&
|
||||
"Destination type must be a vector or builtin type.");
|
||||
Value *Vec = Visit(const_cast<Expr *>(E));
|
||||
Value *Vec = Visit(E);
|
||||
if (auto *VecTy = DestTy->getAs<VectorType>()) {
|
||||
SmallVector<int> Mask;
|
||||
unsigned NumElts = VecTy->getNumElements();
|
||||
|
Loading…
x
Reference in New Issue
Block a user