From 790b4bf9a941884423c2d1f4cdcf26725b74b332 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 2 Dec 2008 06:22:04 +0000 Subject: [PATCH] Merge two if-statements into one. llvm-svn: 60402 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index db2c997d3fbe..b382731586e8 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4443,14 +4443,10 @@ Instruction *InstCombiner::FoldOrWithConstants(BinaryOperator &I, Value *Op, APInt Xor = CI1->getValue() ^ CI2->getValue(); if (!Xor.isAllOnesValue()) return 0; - if (V1 == B) { + if (V1 == A || V1 == B) Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateAnd(A, CI1), I); - return BinaryOperator::CreateOr(NewOp, B); - } else if (V1 == A) { - Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateAnd(B, CI1), I); - return BinaryOperator::CreateOr(NewOp, A); + InsertNewInstBefore(BinaryOperator::CreateAnd((V1 == A) ? B : A, CI1), I); + return BinaryOperator::CreateOr(NewOp, V1); } return 0;