forked from OSchip/llvm-project
Clean up usages of asserting vector getters in Type
Summary: Remove usages of asserting vector getters in Type in preparation for the VectorType refactor. The existence of these functions complicates the refactor while adding little value. Reviewers: efriedma, sdesmalen, rriddle Reviewed By: sdesmalen Subscribers: hiraditya, dantrushin, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77261
This commit is contained in:
parent
c6eb584c64
commit
19cc9b9ded
|
@ -2630,10 +2630,9 @@ bool RewriteStatepointsForGC::runOnFunction(Function &F, DominatorTree &DT,
|
|||
|
||||
unsigned VF = 0;
|
||||
for (unsigned i = 0; i < I.getNumOperands(); i++)
|
||||
if (I.getOperand(i)->getType()->isVectorTy()) {
|
||||
assert(VF == 0 ||
|
||||
VF == I.getOperand(i)->getType()->getVectorNumElements());
|
||||
VF = I.getOperand(i)->getType()->getVectorNumElements();
|
||||
if (auto *OpndVTy = dyn_cast<VectorType>(I.getOperand(i)->getType())) {
|
||||
assert(VF == 0 || VF == OpndVTy->getNumElements());
|
||||
VF = OpndVTy->getNumElements();
|
||||
}
|
||||
|
||||
// It's the vector to scalar traversal through the pointer operand which
|
||||
|
|
|
@ -252,7 +252,7 @@ Scatterer::Scatterer(BasicBlock *bb, BasicBlock::iterator bbi, Value *v,
|
|||
PtrTy = dyn_cast<PointerType>(Ty);
|
||||
if (PtrTy)
|
||||
Ty = PtrTy->getElementType();
|
||||
Size = Ty->getVectorNumElements();
|
||||
Size = cast<VectorType>(Ty)->getNumElements();
|
||||
if (!CachePtr)
|
||||
Tmp.resize(Size, nullptr);
|
||||
else if (CachePtr->empty())
|
||||
|
@ -269,7 +269,7 @@ Value *Scatterer::operator[](unsigned I) {
|
|||
return CV[I];
|
||||
IRBuilder<> Builder(BB, BBI);
|
||||
if (PtrTy) {
|
||||
Type *ElTy = PtrTy->getElementType()->getVectorElementType();
|
||||
Type *ElTy = cast<VectorType>(PtrTy->getElementType())->getElementType();
|
||||
if (!CV[0]) {
|
||||
Type *NewPtrTy = PointerType::get(ElTy, PtrTy->getAddressSpace());
|
||||
CV[0] = Builder.CreateBitCast(V, NewPtrTy, V->getName() + ".i0");
|
||||
|
@ -852,10 +852,10 @@ bool ScalarizerVisitor::finish() {
|
|||
if (!Op->use_empty()) {
|
||||
// The value is still needed, so recreate it using a series of
|
||||
// InsertElements.
|
||||
Type *Ty = Op->getType();
|
||||
auto *Ty = cast<VectorType>(Op->getType());
|
||||
Value *Res = UndefValue::get(Ty);
|
||||
BasicBlock *BB = Op->getParent();
|
||||
unsigned Count = Ty->getVectorNumElements();
|
||||
unsigned Count = Ty->getNumElements();
|
||||
IRBuilder<> Builder(Op);
|
||||
if (isa<PHINode>(Op))
|
||||
Builder.SetInsertPoint(BB, BB->getFirstInsertionPt());
|
||||
|
|
Loading…
Reference in New Issue