Skip to content

Commit 2db6abd

Browse files
committed
remove unnecessary includes and SelectInst variables
1 parent 2555fce commit 2db6abd

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "llvm/IR/Instructions.h"
2525
#include "llvm/IR/Operator.h"
2626
#include "llvm/IR/PatternMatch.h"
27-
#include "llvm/IR/ProfDataUtils.h"
2827
#include "llvm/IR/Type.h"
2928
#include "llvm/IR/Value.h"
3029
#include "llvm/Support/AlignOf.h"
@@ -879,17 +878,13 @@ Instruction *InstCombinerImpl::foldAddWithConstant(BinaryOperator &Add) {
879878
return BinaryOperator::CreateAdd(Builder.CreateNot(Y), X);
880879

881880
// zext(bool) + C -> bool ? C + 1 : C
882-
SelectInst *SI = nullptr;
883881
if (match(Op0, m_ZExt(m_Value(X))) &&
884882
X->getType()->getScalarSizeInBits() == 1)
885-
SI = createSelectInst(X, InstCombiner::AddOne(Op1C), Op1);
883+
return createSelectInst(X, InstCombiner::AddOne(Op1C), Op1);
886884
// sext(bool) + C -> bool ? C - 1 : C
887-
if (!SI && match(Op0, m_SExt(m_Value(X))) &&
885+
if (match(Op0, m_SExt(m_Value(X))) &&
888886
X->getType()->getScalarSizeInBits() == 1)
889-
SI = createSelectInst(X, InstCombiner::SubOne(Op1C), Op1);
890-
if (SI) {
891-
return SI;
892-
}
887+
return createSelectInst(X, InstCombiner::SubOne(Op1C), Op1);
893888

894889
// ~X + C --> (C-1) - X
895890
if (match(Op0, m_Not(m_Value(X)))) {

llvm/lib/Transforms/InstCombine/InstCombineInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
476476
Instruction *MDFrom = nullptr) {
477477
SelectInst *SI =
478478
SelectInst::Create(C, S1, S2, NameStr, InsertBefore, MDFrom);
479-
if (SI && !MDFrom) {
479+
if (!MDFrom) {
480480
setExplicitlyUnknownBranchWeightsIfProfiled(*SI, F, DEBUG_TYPE);
481481
}
482482
return SI;

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "llvm/Analysis/InstructionSimplify.h"
1515
#include "llvm/IR/IntrinsicInst.h"
1616
#include "llvm/IR/PatternMatch.h"
17-
#include "llvm/IR/ProfDataUtils.h"
1817
#include "llvm/Transforms/InstCombine/InstCombiner.h"
1918
using namespace llvm;
2019
using namespace PatternMatch;

0 commit comments

Comments
 (0)