LLVM  mainline
Defines | Functions
InstCombineSelect.cpp File Reference
#include "InstCombineInternal.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/PatternMatch.h"
Include dependency graph for InstCombineSelect.cpp:

Go to the source code of this file.


#define DEBUG_TYPE   "instcombine"


static SelectPatternFlavor getInverseMinMaxSelectPattern (SelectPatternFlavor SPF)
static CmpInst::Predicate getCmpPredicateForMinMax (SelectPatternFlavor SPF, bool Ordered=false)
static ValuegenerateMinMaxSelectPattern (InstCombiner::BuilderTy *Builder, SelectPatternFlavor SPF, Value *A, Value *B)
static unsigned GetSelectFoldableOperands (Instruction *I)
 We want to turn code that looks like this: C = or A, B D = select cond, C, A into: C = select cond, B, 0 D = or A, C.
static ConstantGetSelectFoldableConstant (Instruction *I)
 For the same transformation as the previous function, return the identity constant that goes into the select.
static bool isSelect01 (Constant *C1, Constant *C2)
static ValuefoldSelectICmpAndOr (const SelectInst &SI, Value *TrueVal, Value *FalseVal, InstCombiner::BuilderTy *Builder)
 We want to turn: (select (icmp eq (and X, C1), 0), Y, (or Y, C2)) into: (or (shl (and X, C1), C3), y) iff: C1 and C2 are both powers of 2 where: C3 = Log(C2) - Log(C1)

Define Documentation

#define DEBUG_TYPE   "instcombine"

Definition at line 22 of file InstCombineSelect.cpp.

Function Documentation

static Value* foldSelectICmpAndOr ( const SelectInst SI,
Value TrueVal,
Value FalseVal,
InstCombiner::BuilderTy Builder 
) [static]
static Value* generateMinMaxSelectPattern ( InstCombiner::BuilderTy Builder,
SelectPatternFlavor  SPF,
Value A,
Value B 
) [static]
static CmpInst::Predicate getCmpPredicateForMinMax ( SelectPatternFlavor  SPF,
bool  Ordered = false 
) [static]
static Constant* GetSelectFoldableConstant ( Instruction I) [static]

We want to turn code that looks like this: C = or A, B D = select cond, C, A into: C = select cond, B, 0 D = or A, C.

Assuming that the specified instruction is an operand to the select, return a bitmask indicating which operands of this instruction are foldable if they equal the other incoming value of the select.

Definition at line 81 of file InstCombineSelect.cpp.

References llvm::APIntOps::And(), llvm::Instruction::getOpcode(), llvm::LShr, llvm::APIntOps::Or(), and llvm::APIntOps::Xor().

Referenced by llvm::InstCombiner::FoldSelectIntoOp().

static bool isSelect01 ( Constant C1,
Constant C2 
) [static]