|
LLVM
4.0.0
|
#include "InstCombineInternal.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/PatternMatch.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "instcombine" |
Functions | |
| static bool | canEvaluateShiftedShift (unsigned FirstShiftAmt, bool IsFirstShiftLeft, Instruction *SecondShift, InstCombiner &IC, Instruction *CxtI) |
| Return true if we can simplify two logical (either left or right) shifts that have constant shift amounts. More... | |
| static bool | CanEvaluateShifted (Value *V, unsigned NumBits, bool IsLeftShift, InstCombiner &IC, Instruction *CxtI) |
| See if we can compute the specified value, but shifted logically to the left or right by some number of bits. More... | |
| static Value * | GetShiftedValue (Value *V, unsigned NumBits, bool isLeftShift, InstCombiner &IC, const DataLayout &DL) |
| When CanEvaluateShifted returned true for an expression, this value inserts the new computation that produces the shifted value. More... | |
| static Instruction * | foldShiftByConstOfShiftByConst (BinaryOperator &I, ConstantInt *COp1, InstCombiner::BuilderTy *Builder) |
| Try to fold (X << C1) << C2, where the shifts are some combination of shl/ashr/lshr. More... | |
| #define DEBUG_TYPE "instcombine" |
Definition at line 22 of file InstCombineShifts.cpp.
|
static |
See if we can compute the specified value, but shifted logically to the left or right by some number of bits.
This should return true if the expression can be computed for the same cost as the current expression tree. This is used to eliminate extraneous shifting from things like: C = shl i128 A, 64 D = shl i128 B, 96 E = or i128 C, D F = lshr i128 E, 64 where the client will ask if E can be computed shifted right by 64-bits. If this succeeds, the GetShiftedValue function will be called to produce the value.
Definition at line 124 of file InstCombineShifts.cpp.
References llvm::APIntOps::And(), canEvaluateShiftedShift(), llvm::dyn_cast(), llvm::SelectInst::getFalseValue(), llvm::APInt::getHighBitsSet(), llvm::ConstantInt::getLimitedValue(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::SelectInst::getTrueValue(), llvm::ConstantInt::getZExtValue(), llvm::Value::hasOneUse(), I, llvm::PHINode::incoming_values(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::APIntOps::Or(), llvm::MCID::Select, SI, and llvm::APIntOps::Xor().
Referenced by llvm::InstCombiner::FoldShiftByConstant().
|
static |
Return true if we can simplify two logical (either left or right) shifts that have constant shift amounts.
Definition at line 69 of file InstCombineShifts.cpp.
References assert(), llvm::dyn_cast(), llvm::APInt::getLowBitsSet(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), llvm::Instruction::isLogicalShift(), llvm::BitmaskEnumDetail::Mask(), and llvm::InstCombiner::MaskedValueIsZero().
Referenced by CanEvaluateShifted().
|
static |
Try to fold (X << C1) << C2, where the shifts are some combination of shl/ashr/lshr.
Definition at line 334 of file InstCombineShifts.cpp.
References assert(), llvm::BinaryOperator::Create(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::Value::getContext(), llvm::ConstantInt::getLimitedValue(), llvm::APInt::getLowBitsSet(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::Instruction::isExact(), llvm::Instruction::isShift(), llvm::BitmaskEnumDetail::Mask(), llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::Instruction::setIsExact(), and X.
Referenced by llvm::InstCombiner::FoldShiftByConstant().
|
static |
When CanEvaluateShifted returned true for an expression, this value inserts the new computation that produces the shifted value.
Definition at line 197 of file InstCombineShifts.cpp.
References llvm::InstCombineWorklist::Add(), llvm::APIntOps::And(), assert(), llvm::InstCombiner::Builder, C, llvm::ConstantFoldConstant(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::ConstantInt::get(), llvm::Value::getContext(), llvm::APInt::getHighBitsSet(), llvm::PHINode::getIncomingValue(), llvm::APInt::getLowBitsSet(), llvm::Constant::getNullValue(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::InstCombiner::getTargetLibraryInfo(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantInt::getZExtValue(), I, i, llvm_unreachable, llvm::BitmaskEnumDetail::Mask(), llvm::APIntOps::Or(), llvm::MCID::Select, llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::PHINode::setIncomingValue(), llvm::Instruction::setIsExact(), llvm::User::setOperand(), VI, llvm::InstCombiner::Worklist, and llvm::APIntOps::Xor().
Referenced by llvm::InstCombiner::FoldShiftByConstant().
1.8.6