From 758109ce2e197800f280a1fa32e39cccd0f8784c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 12 Jan 2004 19:08:43 +0000 Subject: [PATCH] Don't use ConstantExpr::getShift anymore llvm-svn: 10791 --- lib/AsmParser/llvmAsmParser.y | 2 +- lib/Bytecode/Reader/ConstantReader.cpp | 2 -- lib/Transforms/Scalar/SCCP.cpp | 29 ++++++-------------------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 600ce480a35..a63c19abd35 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1218,7 +1218,7 @@ ConstExpr: CAST '(' ConstVal TO Types ')' { ThrowException("Shift count for shift constant must be unsigned byte!"); if (!$3->getType()->isInteger()) ThrowException("Shift constant expression requires integer operand!"); - $$ = ConstantExpr::getShift($1, $3, $5); + $$ = ConstantExpr::get($1, $3, $5); }; diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp index 3d5ffd452e6..660566b2664 100644 --- a/lib/Bytecode/Reader/ConstantReader.cpp +++ b/lib/Bytecode/Reader/ConstantReader.cpp @@ -182,8 +182,6 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf, } else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr std::vector IdxList(ArgVec.begin()+1, ArgVec.end()); return ConstantExpr::getGetElementPtr(ArgVec[0], IdxList); - } else if (Opcode == Instruction::Shl || Opcode == Instruction::Shr) { - return ConstantExpr::getShift(Opcode, ArgVec[0], ArgVec[1]); } else { // All other 2-operand expressions return ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]); } diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 7a28281a799..4e5e5156bb7 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -596,19 +596,11 @@ void SCCP::visitBinaryOperator(Instruction &I) { Result.markOverdefined(); break; // Cannot fold this operation over the PHI nodes! } else if (In1.isConstant() && In2.isConstant()) { - Constant *Val = 0; - if (isa(I)) - Val = ConstantExpr::get(I.getOpcode(), In1.getConstant(), - In2.getConstant()); - else { - assert(isa(I) && - "Can only handle binops and shifts here!"); - Val = ConstantExpr::getShift(I.getOpcode(), In1.getConstant(), - In2.getConstant()); - } + Constant *V = ConstantExpr::get(I.getOpcode(), In1.getConstant(), + In2.getConstant()); if (Result.isUndefined()) - Result.markConstant(Val); - else if (Result.isConstant() && Result.getConstant() != Val) { + Result.markConstant(V); + else if (Result.isConstant() && Result.getConstant() != V) { Result.markOverdefined(); break; } @@ -652,17 +644,8 @@ void SCCP::visitBinaryOperator(Instruction &I) { markOverdefined(IV, &I); } else if (V1State.isConstant() && V2State.isConstant()) { - Constant *Result = 0; - if (isa(I)) - Result = ConstantExpr::get(I.getOpcode(), V1State.getConstant(), - V2State.getConstant()); - else { - assert (isa(I) && "Can only handle binops and shifts here!"); - Result = ConstantExpr::getShift(I.getOpcode(), V1State.getConstant(), - V2State.getConstant()); - } - - markConstant(IV, &I, Result); // This instruction constant folds! + markConstant(IV, &I, ConstantExpr::get(I.getOpcode(), V1State.getConstant(), + V2State.getConstant())); } }