llvm.org GIT mirror llvm / 19b50e8
DAG: Add computeKnownBitsForFrameIndex Some of the AMDGPU stack addressing modes require knowing the sign bit is zero. We used to accomplish this by custom lowering frame indexes, and then putting an AssertZext around a TargetFrameIndex. This required specifically looking for the AssextZext + frame index pattern which was moderately disgusting. The same could probably be accomplished with a target specific node, but would still require special handling of frame indexes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317671 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 2 years ago
3 changed file(s) with 23 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
26772677 const SelectionDAG &DAG,
26782678 unsigned Depth = 0) const;
26792679
2680 /// Determine which of the bits of FrameIndex \p FIOp are known to be 0.
2681 /// Default implementation computes low bits based on alignment
2682 /// information. This should preserve known bits passed into it.
2683 virtual void computeKnownBitsForFrameIndex(const SDValue FIOp,
2684 KnownBits &Known,
2685 const APInt &DemandedElts,
2686 const SelectionDAG &DAG,
2687 unsigned Depth = 0) const;
2688
26802689 /// This method can be implemented by targets that want to expose additional
26812690 /// information about sign bits to the DAG Combiner. The DemandedElts
26822691 /// argument allows us to only collect the minimum sign bits that are shared
28922892 }
28932893 case ISD::FrameIndex:
28942894 case ISD::TargetFrameIndex:
2895 if (unsigned Align = InferPtrAlignment(Op)) {
2896 // The low bits are known zero if the pointer is aligned.
2897 Known.Zero.setLowBits(Log2_32(Align));
2898 break;
2899 }
2895 TLI->computeKnownBitsForFrameIndex(Op, Known, DemandedElts, *this, Depth);
29002896 break;
29012897
29022898 default:
12871287 Known.resetAll();
12881288 }
12891289
1290 void TargetLowering::computeKnownBitsForFrameIndex(const SDValue Op,
1291 KnownBits &Known,
1292 const APInt &DemandedElts,
1293 const SelectionDAG &DAG,
1294 unsigned Depth) const {
1295 assert(isa(Op) && "expected FrameIndex");
1296
1297 if (unsigned Align = DAG.InferPtrAlignment(Op)) {
1298 // The low bits are known zero if the pointer is aligned.
1299 Known.Zero.setLowBits(Log2_32(Align));
1300 }
1301 }
1302
12901303 /// This method can be implemented by targets that want to expose additional
12911304 /// information about sign bits to the DAG Combiner.
12921305 unsigned TargetLowering::ComputeNumSignBitsForTargetNode(SDValue Op,