diff options
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 2449739..3a24389 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -1162,7 +1162,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, } // i1 can be simplified in many cases. - if (C1->getType() == Type::getInt1Ty(Context)) { + if (C1->getType()->isInteger(1)) { switch (Opcode) { case Instruction::Add: case Instruction::Sub: @@ -1229,10 +1229,10 @@ static int IdxCompare(LLVMContext &Context, Constant *C1, Constant *C2, // Ok, we have two differing integer indices. Sign extend them to be the same // type. Long is always big enough, so we use it. - if (C1->getType() != Type::getInt64Ty(Context)) + if (!C1->getType()->isInteger(64)) C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(Context)); - if (C2->getType() != Type::getInt64Ty(Context)) + if (!C2->getType()->isInteger(64)) C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(Context)); if (C1 == C2) return 0; // They are equal @@ -1587,7 +1587,7 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, } // If the comparison is a comparison between two i1's, simplify it. - if (C1->getType() == Type::getInt1Ty(Context)) { + if (C1->getType()->isInteger(1)) { switch(pred) { case ICmpInst::ICMP_EQ: if (isa<ConstantInt>(C2)) @@ -2042,10 +2042,10 @@ Constant *llvm::ConstantFoldGetElementPtr(LLVMContext &Context, // Before adding, extend both operands to i64 to avoid // overflow trouble. - if (PrevIdx->getType() != Type::getInt64Ty(Context)) + if (!PrevIdx->getType()->isInteger(64)) PrevIdx = ConstantExpr::getSExt(PrevIdx, Type::getInt64Ty(Context)); - if (Div->getType() != Type::getInt64Ty(Context)) + if (!Div->getType()->isInteger(64)) Div = ConstantExpr::getSExt(Div, Type::getInt64Ty(Context)); |