summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-05-13 18:35:29 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-05-13 18:35:29 +0000
commit4c2814e5d6030a65a3d88fcce8bdf237c9593d72 (patch)
tree5d0f8a11717960312bbc8b43306619ac947424d5 /llvm/lib
parent3e80709ef9cedf04f5001d02b26921c9f0d43d5d (diff)
downloadbcm5719-llvm-4c2814e5d6030a65a3d88fcce8bdf237c9593d72.tar.gz
bcm5719-llvm-4c2814e5d6030a65a3d88fcce8bdf237c9593d72.zip
[opaque pointer type] Constant Folding: Use GEPOperator to access the pointee source type rather than going through the first operand's pointer type
llvm-svn: 237274
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 8afb3e489de..ec3414d2530 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -632,8 +632,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
if (CE->getOpcode() == Instruction::GetElementPtr &&
CE->getOperand(0)->isNullValue()) {
- Type *Ty =
- cast<PointerType>(CE->getOperand(0)->getType())->getElementType();
+ GEPOperator *GEPO = cast<GEPOperator>(CE);
+ Type *Ty = GEPO->getSourceElementType();
if (CE->getNumOperands() == 2) {
// Handle a sizeof-like expression.
Constant *Idx = CE->getOperand(1);
OpenPOWER on IntegriCloud