aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-05-06 23:56:21 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-05-06 23:56:21 +0000
commit567d0e5a90ffbc579136af2dfcee81c2310bdc47 (patch)
tree3199c66c8b493f8adfc79e82fb48fbc375f885e9 /llvm/lib/IR/Constants.cpp
parent3058d0f08026583f1db33a040eac0f8f654dff41 (diff)
downloadllvm-567d0e5a90ffbc579136af2dfcee81c2310bdc47.zip
llvm-567d0e5a90ffbc579136af2dfcee81c2310bdc47.tar.gz
llvm-567d0e5a90ffbc579136af2dfcee81c2310bdc47.tar.bz2
Revert "[opaque pointer type] Pass explicit pointer type through GEP constant folding"
Causes regressions in Clang. Reverting while I investigate. This reverts commit r236670. llvm-svn: 236678
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index b598c28..20a5206 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -2015,16 +2015,14 @@ Constant *ConstantExpr::getSelect(Constant *C, Constant *V1, Constant *V2,
Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C,
ArrayRef<Value *> Idxs, bool InBounds,
Type *OnlyIfReducedTy) {
+ if (Constant *FC = ConstantFoldGetElementPtr(C, InBounds, Idxs))
+ return FC; // Fold a few common cases.
+
if (!Ty)
Ty = cast<PointerType>(C->getType()->getScalarType())->getElementType();
else
- assert(
- Ty ==
- cast<PointerType>(C->getType()->getScalarType())->getContainedType(0u));
-
- if (Constant *FC = ConstantFoldGetElementPtr(Ty, C, InBounds, Idxs))
- return FC; // Fold a few common cases.
-
+ assert(Ty ==
+ cast<PointerType>(C->getType()->getScalarType())->getElementType());
// Get the result type of the getelementptr!
Type *DestTy = GetElementPtrInst::getIndexedType(Ty, Idxs);
assert(DestTy && "GEP indices invalid!");