mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[InstCombine] No need to pass DataLayout to helper functions if we're passing the InstCombiner object. We can just ask it for the DataLayout. NFC
llvm-svn: 307333
This commit is contained in:
parent
743fbcd524
commit
a149827294
@ -406,8 +406,7 @@ static bool canEvaluateTruncated(Value *V, Type *Ty, InstCombiner &IC,
|
|||||||
/// trunc (lshr (bitcast <4 x i32> %X to i128), 32) to i32
|
/// trunc (lshr (bitcast <4 x i32> %X to i128), 32) to i32
|
||||||
/// --->
|
/// --->
|
||||||
/// extractelement <4 x i32> %X, 1
|
/// extractelement <4 x i32> %X, 1
|
||||||
static Instruction *foldVecTruncToExtElt(TruncInst &Trunc, InstCombiner &IC,
|
static Instruction *foldVecTruncToExtElt(TruncInst &Trunc, InstCombiner &IC) {
|
||||||
const DataLayout &DL) {
|
|
||||||
Value *TruncOp = Trunc.getOperand(0);
|
Value *TruncOp = Trunc.getOperand(0);
|
||||||
Type *DestType = Trunc.getType();
|
Type *DestType = Trunc.getType();
|
||||||
if (!TruncOp->hasOneUse() || !isa<IntegerType>(DestType))
|
if (!TruncOp->hasOneUse() || !isa<IntegerType>(DestType))
|
||||||
@ -438,7 +437,7 @@ static Instruction *foldVecTruncToExtElt(TruncInst &Trunc, InstCombiner &IC,
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned Elt = ShiftAmount / DestWidth;
|
unsigned Elt = ShiftAmount / DestWidth;
|
||||||
if (DL.isBigEndian())
|
if (IC.getDataLayout().isBigEndian())
|
||||||
Elt = NumVecElts - 1 - Elt;
|
Elt = NumVecElts - 1 - Elt;
|
||||||
|
|
||||||
return ExtractElementInst::Create(VecInput, IC.Builder->getInt32(Elt));
|
return ExtractElementInst::Create(VecInput, IC.Builder->getInt32(Elt));
|
||||||
@ -645,7 +644,7 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Instruction *I = foldVecTruncToExtElt(CI, *this, DL))
|
if (Instruction *I = foldVecTruncToExtElt(CI, *this))
|
||||||
return I;
|
return I;
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1845,8 +1844,7 @@ static Value *optimizeIntegerToVectorInsertions(BitCastInst &CI,
|
|||||||
/// vectors better than bitcasts of scalars because vector registers are
|
/// vectors better than bitcasts of scalars because vector registers are
|
||||||
/// usually not type-specific like scalar integer or scalar floating-point.
|
/// usually not type-specific like scalar integer or scalar floating-point.
|
||||||
static Instruction *canonicalizeBitCastExtElt(BitCastInst &BitCast,
|
static Instruction *canonicalizeBitCastExtElt(BitCastInst &BitCast,
|
||||||
InstCombiner &IC,
|
InstCombiner &IC) {
|
||||||
const DataLayout &DL) {
|
|
||||||
// TODO: Create and use a pattern matcher for ExtractElementInst.
|
// TODO: Create and use a pattern matcher for ExtractElementInst.
|
||||||
auto *ExtElt = dyn_cast<ExtractElementInst>(BitCast.getOperand(0));
|
auto *ExtElt = dyn_cast<ExtractElementInst>(BitCast.getOperand(0));
|
||||||
if (!ExtElt || !ExtElt->hasOneUse())
|
if (!ExtElt || !ExtElt->hasOneUse())
|
||||||
@ -2204,7 +2202,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
|
|||||||
if (Instruction *I = optimizeBitCastFromPhi(CI, PN))
|
if (Instruction *I = optimizeBitCastFromPhi(CI, PN))
|
||||||
return I;
|
return I;
|
||||||
|
|
||||||
if (Instruction *I = canonicalizeBitCastExtElt(CI, *this, DL))
|
if (Instruction *I = canonicalizeBitCastExtElt(CI, *this))
|
||||||
return I;
|
return I;
|
||||||
|
|
||||||
if (Instruction *I = foldBitCastBitwiseLogic(CI, *Builder))
|
if (Instruction *I = foldBitCastBitwiseLogic(CI, *Builder))
|
||||||
|
Loading…
Reference in New Issue
Block a user