LLVM 19.0.0git
Macros | Functions | Variables
InstCombineSimplifyDemanded.cpp File Reference
#include "InstCombineInternal.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Transforms/InstCombine/InstCombiner.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instcombine"
 

Functions

static bool ShrinkDemandedConstant (Instruction *I, unsigned OpNo, const APInt &Demanded)
 Check to see if the specified operand of the specified instruction is a constant integer.
 
static unsigned getBitWidth (Type *Ty, const DataLayout &DL)
 Returns the bitwidth of the given scalar or pointer type.
 
static ConstantgetFPClassConstant (Type *Ty, FPClassTest Mask)
 For floating-point classes that resolve to a single bit pattern, return that value.
 

Variables

static cl::opt< boolVerifyKnownBits ("instcombine-verify-known-bits", cl::desc("Verify that computeKnownBits() and " "SimplifyDemandedBits() are consistent"), cl::Hidden, cl::init(false))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "instcombine"

Definition at line 25 of file InstCombineSimplifyDemanded.cpp.

Function Documentation

◆ getBitWidth()

static unsigned getBitWidth ( Type Ty,
const DataLayout DL 
)
static

Returns the bitwidth of the given scalar or pointer type.

For vector types, returns the element type's bitwidth.

Definition at line 59 of file InstCombineSimplifyDemanded.cpp.

References llvm::BitWidth, DL, and llvm::Type::getScalarSizeInBits().

◆ getFPClassConstant()

static Constant * getFPClassConstant ( Type Ty,
FPClassTest  Mask 
)
static

For floating-point classes that resolve to a single bit pattern, return that value.

Definition at line 1955 of file InstCombineSimplifyDemanded.cpp.

References llvm::fcNegInf, llvm::fcNegZero, llvm::fcNone, llvm::fcPosInf, llvm::fcPosZero, llvm::PoisonValue::get(), llvm::ConstantFP::getInfinity(), and llvm::ConstantFP::getZero().

Referenced by llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().

◆ ShrinkDemandedConstant()

static bool ShrinkDemandedConstant ( Instruction I,
unsigned  OpNo,
const APInt Demanded 
)
static

Check to see if the specified operand of the specified instruction is a constant integer.

If so, check to see if there are any bits set in the constant that are not demanded. If so, shrink the constant and return true.

Definition at line 36 of file InstCombineSimplifyDemanded.cpp.

References assert(), llvm::CallingConv::C, I, llvm::PatternMatch::m_APInt(), and llvm::PatternMatch::match().

Referenced by llvm::TargetLowering::ShrinkDemandedConstant(), llvm::TargetLowering::SimplifyDemandedBits(), and llvm::InstCombinerImpl::SimplifyDemandedUseBits().

Variable Documentation

◆ VerifyKnownBits

cl::opt< bool > VerifyKnownBits("instcombine-verify-known-bits", cl::desc("Verify that computeKnownBits() and " "SimplifyDemandedBits() are consistent"), cl::Hidden, cl::init(false)) ( "instcombine-verify-known-bits"  ,
cl::desc("Verify that computeKnownBits() and " "SimplifyDemandedBits() are consistent")  ,
cl::Hidden  ,
cl::init(false)   
)
static