mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
Increase opportunities to optimize (brcond (srl (and c1), c2)).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2755,7 +2755,34 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
|
||||
if (N1C && SimplifyDemandedBits(SDValue(N, 0)))
|
||||
return SDValue(N, 0);
|
||||
|
||||
return N1C ? visitShiftByConstant(N, N1C->getZExtValue()) : SDValue();
|
||||
if (N1C) {
|
||||
SDValue NewSRL = visitShiftByConstant(N, N1C->getZExtValue());
|
||||
if (NewSRL.getNode())
|
||||
return NewSRL;
|
||||
}
|
||||
|
||||
// Here is a common situation. We want to optimize:
|
||||
//
|
||||
// %a = ...
|
||||
// %b = and i32 %a, 2
|
||||
// %c = srl i32 %b, 1
|
||||
// brcond i32 %c ...
|
||||
//
|
||||
// into
|
||||
//
|
||||
// %a = ...
|
||||
// %b = and %a, 2
|
||||
// %c = setcc eq %b, 0
|
||||
// brcond %c ...
|
||||
//
|
||||
// However when after the source operand of SRL is optimized into AND, the SRL
|
||||
// itself may not be optimized further. Look for it and add the BRCOND into
|
||||
// the worklist.
|
||||
if (N->hasOneUse() &&
|
||||
N->use_begin()->getOpcode() == ISD::BRCOND)
|
||||
AddToWorkList(*N->use_begin());
|
||||
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
SDValue DAGCombiner::visitCTLZ(SDNode *N) {
|
||||
|
||||
Reference in New Issue
Block a user