aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp7
-rw-r--r--lib/VMCore/Type.cpp3
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 0d32eac..a2658b3 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -10695,12 +10695,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
gep_type_iterator GTI = gep_type_begin(GEP);
for (User::op_iterator i = GEP.op_begin() + 1, e = GEP.op_end();
i != e; ++i, ++GTI) {
- // Before trying to eliminate/introduce cast/ext/trunc to make
- // indices as pointer types, make sure that the pointer size
- // makes a valid sequential index.
- const SequentialType *ST = dyn_cast<SequentialType>(*GTI);
- Value *PtrTypeVal = Constant::getNullValue(TD->getIntPtrType());
- if (ST && ST->indexValid(PtrTypeVal)) {
+ if (isa<SequentialType>(*GTI)) {
if (CastInst *CI = dyn_cast<CastInst>(*i)) {
if (CI->getOpcode() == Instruction::ZExt ||
CI->getOpcode() == Instruction::SExt) {
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 7e6bbe5..c85395f 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -1411,7 +1411,8 @@ void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {
bool SequentialType::indexValid(const Value *V) const {
if (const IntegerType *IT = dyn_cast<IntegerType>(V->getType()))
- return IT->getBitWidth() == 32 || IT->getBitWidth() == 64;
+ return IT->getBitWidth() == 16 || IT->getBitWidth() == 32 ||
+ IT->getBitWidth() == 64;
return false;
}