Changeset View
Changeset View
Standalone View
Standalone View
lib/Analysis/InstructionSimplify.cpp
Show First 20 Lines • Show All 1,430 Lines • ▼ Show 20 Lines | if (match(Op0, m_Undef())) | ||||
return Constant::getAllOnesValue(Op0->getType()); | return Constant::getAllOnesValue(Op0->getType()); | ||||
// (X << A) >> A -> X | // (X << A) >> A -> X | ||||
Value *X; | Value *X; | ||||
if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) && | if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) && | ||||
cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap()) | cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap()) | ||||
return X; | return X; | ||||
// Arithmetic shifting an all-sign-bit value is a no-op. | |||||
unsigned NumSignBits = ComputeNumSignBits(Op0); | |||||
if (NumSignBits == Op0->getType()->getScalarSizeInBits()) | |||||
return Op0; | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact, | Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact, | ||||
const DataLayout *DL, | const DataLayout *DL, | ||||
const TargetLibraryInfo *TLI, | const TargetLibraryInfo *TLI, | ||||
const DominatorTree *DT) { | const DominatorTree *DT) { | ||||
return ::SimplifyAShrInst(Op0, Op1, isExact, Query (DL, TLI, DT), | return ::SimplifyAShrInst(Op0, Op1, isExact, Query (DL, TLI, DT), | ||||
▲ Show 20 Lines • Show All 1,861 Lines • Show Last 20 Lines |