From c6646ebdb957a3c613d389be8b0135271b8b8ece Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 12 Jan 2004 19:10:58 +0000 Subject: [PATCH] Remove use of ConstantExpr::getShift git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10792 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 6 ------ lib/Transforms/Utils/Linker.cpp | 6 ------ lib/Transforms/Utils/Local.cpp | 5 +---- lib/Transforms/Utils/ValueMapper.cpp | 6 ------ lib/VMCore/Linker.cpp | 6 ------ 5 files changed, 1 insertion(+), 28 deletions(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index af430bd70b7..457a8b97b65 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -324,12 +324,6 @@ 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); diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index af430bd70b7..457a8b97b65 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -324,12 +324,6 @@ 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); diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index b55b2eb77b4..11b6515967e 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -74,16 +74,13 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I) { case 0: return 0; } - if (isa(I)) + if (isa(I) || isa(I)) return ConstantExpr::get(I->getOpcode(), Op0, Op1); switch (I->getOpcode()) { default: return 0; case Instruction::Cast: return ConstantExpr::getCast(Op0, I->getType()); - case Instruction::Shl: - case Instruction::Shr: - return ConstantExpr::getShift(I->getOpcode(), Op0, Op1); case Instruction::GetElementPtr: std::vector IdxList; IdxList.reserve(I->getNumOperands()-1); diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 40dd58a1461..acc433a6ed2 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -83,12 +83,6 @@ Value *llvm::MapValue(const Value *V, std::map &VM) { for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i) Idx.push_back(cast(MapValue(CE->getOperand(i), VM))); return VMSlot = ConstantExpr::getGetElementPtr(MV, Idx); - } else if (CE->getOpcode() == Instruction::Shl || - CE->getOpcode() == Instruction::Shr) { - assert(CE->getNumOperands() == 2 && "Must be a shift!"); - Constant *MV1 = cast(MapValue(CE->getOperand(0), VM)); - Constant *MV2 = cast(MapValue(CE->getOperand(1), VM)); - return VMSlot = ConstantExpr::getShift(CE->getOpcode(), MV1, MV2); } else { assert(CE->getNumOperands() == 2 && "Must be binary operator?"); Constant *MV1 = cast(MapValue(CE->getOperand(0), VM)); diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index af430bd70b7..457a8b97b65 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -324,12 +324,6 @@ 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);