diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-05-06 23:56:21 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-05-06 23:56:21 +0000 |
| commit | 567d0e5a90ffbc579136af2dfcee81c2310bdc47 (patch) | |
| tree | 3199c66c8b493f8adfc79e82fb48fbc375f885e9 /llvm/lib/IR/Constants.cpp | |
| parent | 3058d0f08026583f1db33a040eac0f8f654dff41 (diff) | |
| download | bcm5719-llvm-567d0e5a90ffbc579136af2dfcee81c2310bdc47.tar.gz bcm5719-llvm-567d0e5a90ffbc579136af2dfcee81c2310bdc47.zip | |
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.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index b598c2807ce..20a5206c230 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!"); |

