[opaque pointer types] Remove some calls to generic Type subtype accessors.
That is, remove many of the calls to Type::getNumContainedTypes(),
Type::subtypes(), and Type::getContainedType(N).
I'm not intending to remove these accessors -- they are
useful/necessary in some cases. However, removing the pointee type
from pointers would potentially break some uses, and reducing the
number of calls makes it easier to audit.
llvm-svn: 350835
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index df09d13..d36967f 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1999,9 +1999,8 @@
if (!Ty)
Ty = cast<PointerType>(C->getType()->getScalarType())->getElementType();
else
- assert(
- Ty ==
- cast<PointerType>(C->getType()->getScalarType())->getContainedType(0u));
+ assert(Ty ==
+ cast<PointerType>(C->getType()->getScalarType())->getElementType());
if (Constant *FC =
ConstantFoldGetElementPtr(Ty, C, InBounds, InRangeIndex, Idxs))
diff --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index 3596b31..12ada13 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -257,7 +257,7 @@
if (ArrayType *AT = dyn_cast<ArrayType>(Ty))
return containsGCPtrType(AT->getElementType());
if (StructType *ST = dyn_cast<StructType>(Ty))
- return llvm::any_of(ST->subtypes(), containsGCPtrType);
+ return llvm::any_of(ST->elements(), containsGCPtrType);
return false;
}