mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
[opaque pointer type] Constant Folding: Use GEPOperator to access the pointee source type rather than going through the first operand's pointer type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237274 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
115494b777
commit
428e9d7608
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user