From d981f8af79be9ea647d593531091740a3a27a85f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 5 Nov 2003 20:37:01 +0000 Subject: [PATCH] Further fixes for PR93 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9738 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 8 +++++++- lib/Transforms/Utils/Linker.cpp | 8 +++++++- lib/VMCore/Linker.cpp | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 98dbacc3ea7..0be840fb6cd 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -318,13 +318,19 @@ static Value *RemapOperand(const Value *In, assert(CE->getOpcode() == Instruction::Cast); Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); Result = ConstantExpr::getCast(cast(V), CE->getType()); + } else if (CE->getOpcode() == Instruction::Shl || + CE->getOpcode() == Instruction::Shr) { // Shift + Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); + Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); + Result = ConstantExpr::getShift(CE->getOpcode(), cast(V1), + cast(V2)); } else if (CE->getNumOperands() == 2) { // Binary operator... Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); Result = ConstantExpr::get(CE->getOpcode(), cast(V1), - cast(V2)); + cast(V2)); } else { assert(0 && "Unknown constant expr type!"); } diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index 98dbacc3ea7..0be840fb6cd 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -318,13 +318,19 @@ static Value *RemapOperand(const Value *In, assert(CE->getOpcode() == Instruction::Cast); Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); Result = ConstantExpr::getCast(cast(V), CE->getType()); + } else if (CE->getOpcode() == Instruction::Shl || + CE->getOpcode() == Instruction::Shr) { // Shift + Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); + Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); + Result = ConstantExpr::getShift(CE->getOpcode(), cast(V1), + cast(V2)); } else if (CE->getNumOperands() == 2) { // Binary operator... Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); Result = ConstantExpr::get(CE->getOpcode(), cast(V1), - cast(V2)); + cast(V2)); } else { assert(0 && "Unknown constant expr type!"); } diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index 98dbacc3ea7..0be840fb6cd 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -318,13 +318,19 @@ static Value *RemapOperand(const Value *In, assert(CE->getOpcode() == Instruction::Cast); Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); Result = ConstantExpr::getCast(cast(V), CE->getType()); + } else if (CE->getOpcode() == Instruction::Shl || + CE->getOpcode() == Instruction::Shr) { // Shift + Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); + Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); + Result = ConstantExpr::getShift(CE->getOpcode(), cast(V1), + cast(V2)); } else if (CE->getNumOperands() == 2) { // Binary operator... Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); Result = ConstantExpr::get(CE->getOpcode(), cast(V1), - cast(V2)); + cast(V2)); } else { assert(0 && "Unknown constant expr type!"); }