diff options
author | Arthur Eubanks <aeubanks@google.com> | 2021-05-26 20:32:04 -0700 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2021-05-31 09:54:57 -0700 |
commit | 2c3afa32377693514e400aee10f27b691887b4cf (patch) | |
tree | bc1dbf36094e54522a498350411c3200c32bcce0 /llvm/lib/IR/ConstantFold.cpp | |
parent | 116179c2ee5213f2ae8f07a400ac98f0c995b3d3 (diff) | |
download | llvm-2c3afa32377693514e400aee10f27b691887b4cf.zip llvm-2c3afa32377693514e400aee10f27b691887b4cf.tar.gz llvm-2c3afa32377693514e400aee10f27b691887b4cf.tar.bz2 |
[OpaquePtr] Clean up some uses of Type::getPointerElementType()
These depend on pointee types.
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 84e773a..78e21aee 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -880,7 +880,7 @@ Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val, // ee (gep (ptr, idx0, ...), idx) -> gep (ee (ptr, idx), ee (idx0, idx), ...) if (auto *CE = dyn_cast<ConstantExpr>(Val)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { + if (auto *GEP = dyn_cast<GEPOperator>(CE)) { SmallVector<Constant *, 8> Ops; Ops.reserve(CE->getNumOperands()); for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { @@ -894,7 +894,7 @@ Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val, Ops.push_back(Op); } return CE->getWithOperands(Ops, ValVTy->getElementType(), false, - Ops[0]->getType()->getPointerElementType()); + GEP->getSourceElementType()); } else if (CE->getOpcode() == Instruction::InsertElement) { if (const auto *IEIdx = dyn_cast<ConstantInt>(CE->getOperand(2))) { if (APSInt::isSameValue(APSInt(IEIdx->getValue()), |