diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-03-14 01:53:18 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-03-14 01:53:18 +0000 |
commit | 741c8f81e469930b7c72a59c82adae12c933b1e2 (patch) | |
tree | f6160caeab7ccf4a7b1605e11a7a141d342f8f46 /llvm/lib/IR/Constants.cpp | |
parent | 082c5c707a1a3a42c1d1b4c1a1dbd9139463cd3e (diff) | |
download | bcm5719-llvm-741c8f81e469930b7c72a59c82adae12c933b1e2.tar.gz bcm5719-llvm-741c8f81e469930b7c72a59c82adae12c933b1e2.zip |
[opaque pointer type] Start migrating GEP creation to explicitly specify the pointee type
I'm just going to migrate these in a pretty ad-hoc & incremental way -
providing the backwards compatible API for now, then locally removing
it, fixing a few callers, adding it back in and commiting those callers.
Rinse, repeat.
The assertions should ensure that if I get this wrong we'll find out
about it and not just have one giant patch to revert, recommit, revert,
recommit, etc.
llvm-svn: 232240
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index f5d901c2cc6..e51a396a0bf 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -3001,12 +3001,14 @@ Instruction *ConstantExpr::getAsInstruction() { case Instruction::ShuffleVector: return new ShuffleVectorInst(Ops[0], Ops[1], Ops[2]); - case Instruction::GetElementPtr: - if (cast<GEPOperator>(this)->isInBounds()) - return GetElementPtrInst::CreateInBounds(Ops[0], Ops.slice(1)); - else - return GetElementPtrInst::Create(Ops[0], Ops.slice(1)); - + case Instruction::GetElementPtr: { + const auto *GO = cast<GEPOperator>(this); + if (GO->isInBounds()) + return GetElementPtrInst::CreateInBounds(GO->getSourceElementType(), + Ops[0], Ops.slice(1)); + return GetElementPtrInst::Create(GO->getSourceElementType(), Ops[0], + Ops.slice(1)); + } case Instruction::ICmp: case Instruction::FCmp: return CmpInst::Create((Instruction::OtherOps)getOpcode(), |