mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Try to fold each element of a vector. This is needed to maintain structural
equivalence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55694 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b19e56051
commit
8373d38afd
@ -238,12 +238,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
|
||||
std::vector<Constant*> res;
|
||||
const VectorType *DestVecTy = cast<VectorType>(DestTy);
|
||||
const Type *DstEltTy = DestVecTy->getElementType();
|
||||
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i) {
|
||||
Constant *C = ConstantFoldCastInstruction(opc, CV->getOperand(i),
|
||||
DstEltTy);
|
||||
if (!C) return 0; // Can't fold operand.
|
||||
res.push_back(C);
|
||||
}
|
||||
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
|
||||
res.push_back(ConstantExpr::getCast(opc, CV->getOperand(i), DstEltTy));
|
||||
return ConstantVector::get(DestVecTy, res);
|
||||
}
|
||||
return 0; // Can't fold.
|
||||
@ -271,12 +267,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
|
||||
std::vector<Constant*> res;
|
||||
const VectorType *DestVecTy = cast<VectorType>(DestTy);
|
||||
const Type *DstEltTy = DestVecTy->getElementType();
|
||||
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i) {
|
||||
Constant *C = ConstantFoldCastInstruction(opc, CV->getOperand(i),
|
||||
DstEltTy);
|
||||
if (!C) return 0; // Can't fold operand.
|
||||
res.push_back(C);
|
||||
}
|
||||
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
|
||||
res.push_back(ConstantExpr::getCast(opc, CV->getOperand(i), DstEltTy));
|
||||
return ConstantVector::get(DestVecTy, res);
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user