mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Simplify demanded bits of select sources where the condition is a constant vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -899,5 +899,16 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
return &SI;
|
||||
}
|
||||
|
||||
if (VectorType* VecTy = dyn_cast<VectorType>(SI.getType())) {
|
||||
unsigned VWidth = VecTy->getNumElements();
|
||||
APInt UndefElts(VWidth, 0);
|
||||
APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
|
||||
if (Value *V = SimplifyDemandedVectorElts(&SI, AllOnesEltMask, UndefElts)) {
|
||||
if (V != &SI)
|
||||
return ReplaceInstUsesWith(SI, V);
|
||||
return &SI;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user