diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-05 21:04:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-05 21:04:47 +0000 |
commit | fd7e42b65d7bd07eb956f2605216b9b3419263a9 (patch) | |
tree | 1623033b864617cf18c596c3de23c397e31f4ba4 | |
parent | 4cb7702c4f0bec039dfcb168ddd8e0cd02e7f82b (diff) | |
download | bcm5719-llvm-fd7e42b65d7bd07eb956f2605216b9b3419263a9.tar.gz bcm5719-llvm-fd7e42b65d7bd07eb956f2605216b9b3419263a9.zip |
move a zext specific xform out of commonIntCastTransforms into visitZExt and modernize it.
llvm-svn: 92770
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index e2bb3fbe04a..4b8c5534dfa 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -645,16 +645,6 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) { cast<BinaryOperator>(SrcI)->getOpcode(), Op0c, Op1c); } } - - // cast (xor bool X, true) to int --> xor (cast bool X to int), 1 - if (isa<ZExtInst>(CI) && SrcBitSize == 1 && - SrcI->getOpcode() == Instruction::Xor && - Op1 == ConstantInt::getTrue(CI.getContext()) && - (!Op0->hasOneUse() || !isa<CmpInst>(Op0))) { - Value *New = Builder->CreateZExt(Op0, DestTy, Op0->getName()); - return BinaryOperator::CreateXor(New, - ConstantInt::get(CI.getType(), 1)); - } break; } return 0; @@ -933,6 +923,15 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) { } } + // zext (xor i1 X, true) to i32 --> xor (zext i1 X to i32), 1 + Value *X; + if (SrcI && SrcI->getType()->isInteger(1) && + match(SrcI, m_Not(m_Value(X))) && + (!X->hasOneUse() || !isa<CmpInst>(X))) { + Value *New = Builder->CreateZExt(X, CI.getType()); + return BinaryOperator::CreateXor(New, ConstantInt::get(CI.getType(), 1)); + } + return 0; } |