From 4b12cdec01ca51dbe6f1ee75b868d8f65504925a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 21 Apr 2003 21:33:44 +0000 Subject: [PATCH] Add support for a simple constantexpr: cast of one ptr type to another git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5829 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/InstSelectSimple.cpp | 5 +++++ lib/Target/X86/X86ISelSimple.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 91d3013ecd0..6adccb15e8a 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/lib/Target/X86/InstSelectSimple.cpp @@ -307,6 +307,11 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB, emitGEPOperation(MBB, IP, CE->getOperand(0), CE->op_begin()+1, CE->op_end(), R); return; + } else if (CE->getOpcode() == Instruction::Cast && + isa(CE->getType()) && + isa(CE->getOperand(0)->getType())) { + copyConstantToRegister(MBB, IP, cast(CE->getOperand(0)), R); + return; } std::cerr << "Offending expr: " << C << "\n"; diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp index 91d3013ecd0..6adccb15e8a 100644 --- a/lib/Target/X86/X86ISelSimple.cpp +++ b/lib/Target/X86/X86ISelSimple.cpp @@ -307,6 +307,11 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB, emitGEPOperation(MBB, IP, CE->getOperand(0), CE->op_begin()+1, CE->op_end(), R); return; + } else if (CE->getOpcode() == Instruction::Cast && + isa(CE->getType()) && + isa(CE->getOperand(0)->getType())) { + copyConstantToRegister(MBB, IP, cast(CE->getOperand(0)), R); + return; } std::cerr << "Offending expr: " << C << "\n"; -- 2.40.0