diff options
author | Manuel Jacob <me@manueljacob.de> | 2016-01-17 22:46:43 +0000 |
---|---|---|
committer | Manuel Jacob <me@manueljacob.de> | 2016-01-17 22:46:43 +0000 |
commit | 20c6d5bcb8ad508d07b3be91a28ba4b93131c33d (patch) | |
tree | 49aebe7493d8a2e704591ad5b75c7faba0172ffb /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | 190577ac81d6c7ef6c58850cfbbb3bf18c7c7fab (diff) | |
download | llvm-20c6d5bcb8ad508d07b3be91a28ba4b93131c33d.zip llvm-20c6d5bcb8ad508d07b3be91a28ba4b93131c33d.tar.gz llvm-20c6d5bcb8ad508d07b3be91a28ba4b93131c33d.tar.bz2 |
[opaque pointer types] [breaking-change] [NFC] SimplifyGEPInst: take the source element type of the GEP as an argument.
Patch by Eduard Burtescu.
Reviewers: dblaikie, mjacob
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D16281
llvm-svn: 258024
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 6dfe625..5c4deda 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -3527,13 +3527,13 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops, Ops.slice(1)); } -Value *llvm::SimplifyGEPInst(ArrayRef<Value *> Ops, const DataLayout &DL, +Value *llvm::SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops, + const DataLayout &DL, const TargetLibraryInfo *TLI, const DominatorTree *DT, AssumptionCache *AC, const Instruction *CxtI) { - return ::SimplifyGEPInst( - cast<PointerType>(Ops[0]->getType()->getScalarType())->getElementType(), - Ops, Query(DL, TLI, DT, AC, CxtI), RecursionLimit); + return ::SimplifyGEPInst(SrcTy, Ops, + Query(DL, TLI, DT, AC, CxtI), RecursionLimit); } /// Given operands for an InsertValueInst, see if we can fold the result. @@ -4038,7 +4038,8 @@ Value *llvm::SimplifyInstruction(Instruction *I, const DataLayout &DL, break; case Instruction::GetElementPtr: { SmallVector<Value*, 8> Ops(I->op_begin(), I->op_end()); - Result = SimplifyGEPInst(Ops, DL, TLI, DT, AC, I); + Result = SimplifyGEPInst(cast<GetElementPtrInst>(I)->getSourceElementType(), + Ops, DL, TLI, DT, AC, I); break; } case Instruction::InsertValue: { |