LLVM  4.0.0
Macros | 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/MDBuilder.h"
#include "llvm/IR/PatternMatch.h"
Include dependency graph for InstCombineSelect.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instcombine"
 

Functions

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. More...
 
static ConstantgetSelectFoldableConstant (Instruction *I)
 For the same transformation as the previous function, return the identity constant that goes into the select. More...
 
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) More...
 

Macro Definition Documentation

#define DEBUG_TYPE   "instcombine"

Definition at line 23 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 SelectPatternFlavor getInverseMinMaxSelectPattern ( SelectPatternFlavor  SPF)
static
static Constant* getSelectFoldableConstant ( Instruction I)
static

For the same transformation as the previous function, return the identity constant that goes into the select.

Definition at line 102 of file InstCombineSelect.cpp.

References llvm::MCID::Add, llvm::APIntOps::And(), llvm::ConstantInt::get(), llvm::Constant::getAllOnesValue(), llvm::Constant::getNullValue(), llvm::Instruction::getOpcode(), llvm::Value::getType(), llvm_unreachable, llvm::APIntOps::Or(), and llvm::APIntOps::Xor().

static unsigned getSelectFoldableOperands ( 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 82 of file InstCombineSelect.cpp.

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

static bool isSelect01 ( Constant C1,
Constant C2 
)
static