Skip to content

Commit dbfd598

Browse files
author
Nimit Sachdeva
committed
refactorization
1 parent f3c8b3a commit dbfd598

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
#include "llvm/Support/KnownBits.h"
4343
#include "llvm/Transforms/InstCombine/InstCombiner.h"
4444
#include <cassert>
45-
#include <cstddef>
46-
#include <iostream>
4745
#include <utility>
4846

4947
#define DEBUG_TYPE "instcombine"
@@ -52,6 +50,7 @@
5250
using namespace llvm;
5351
using namespace PatternMatch;
5452

53+
5554
/// Replace a select operand based on an equality comparison with the identity
5655
/// constant of a binop.
5756
static Instruction *foldSelectBinOpIdentity(SelectInst &Sel,
@@ -1714,6 +1713,7 @@ tryToReuseConstantFromSelectInComparison(SelectInst &Sel, ICmpInst &Cmp,
17141713
if (Pred == CmpInst::ICMP_ULT && match(X, m_Add(m_Value(), m_Constant())))
17151714
return nullptr;
17161715

1716+
17171717
Value *SelVal0, *SelVal1; // We do not care which one is from where.
17181718
match(&Sel, m_Select(m_Value(), m_Value(SelVal0), m_Value(SelVal1)));
17191719
// At least one of these values we are selecting between must be a constant
@@ -2004,8 +2004,7 @@ Value *InstCombinerImpl::foldSelectWithConstOpToBinOp(ICmpInst *Cmp,
20042004
/// %b_sub' = usub.sat(y, IntConst2 - MostSignificantBit)
20052005
/// %or = or %a_sub', %b_sub'
20062006
/// %and = and %or, MostSignificantBit
2007-
/// If the args are vectors
2008-
///
2007+
/// Likewise, for vector arguments as well.
20092008
static Instruction *foldICmpUSubSatWithAndForMostSignificantBitCmp(
20102009
SelectInst &SI, ICmpInst *ICI, InstCombiner::BuilderTy &Builder) {
20112010
auto *CI = dyn_cast<ICmpInst>(SI.getCondition());
@@ -4332,9 +4331,10 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
43324331
bool IsCastNeeded = LHS->getType() != SelType;
43334332
Value *CmpLHS = cast<CmpInst>(CondVal)->getOperand(0);
43344333
Value *CmpRHS = cast<CmpInst>(CondVal)->getOperand(1);
4335-
if (IsCastNeeded || (LHS->getType()->isFPOrFPVectorTy() &&
4336-
((CmpLHS != LHS && CmpLHS != RHS) ||
4337-
(CmpRHS != LHS && CmpRHS != RHS)))) {
4334+
if (IsCastNeeded ||
4335+
(LHS->getType()->isFPOrFPVectorTy() &&
4336+
((CmpLHS != LHS && CmpLHS != RHS) ||
4337+
(CmpRHS != LHS && CmpRHS != RHS)))) {
43384338
CmpInst::Predicate MinMaxPred = getMinMaxPred(SPF, SPR.Ordered);
43394339

43404340
Value *Cmp;

0 commit comments

Comments
 (0)