[PATCH] D39368: DAG: Add computeKnownBitsForFrameIndex
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 03:11:28 PDT 2017
Matt Arsenault via Phabricator <reviews at reviews.llvm.org> writes:
> arsenm created this revision.
> Herald added subscribers: tpr, wdng.
>
> 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.
Adding this hook seems fine, but please add a documentation comment
explaining what its for to the default implementation.
>
> https://reviews.llvm.org/D39368
>
> Files:
> include/llvm/Target/TargetLowering.h
> lib/CodeGen/SelectionDAG/SelectionDAG.cpp
>
> Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> @@ -2854,8 +2854,9 @@
> if (unsigned Align = InferPtrAlignment(Op)) {
> // The low bits are known zero if the pointer is aligned.
> Known.Zero.setLowBits(Log2_32(Align));
> - break;
> }
> +
> + TLI->computeKnownBitsForFrameIndex(Op, Known, DemandedElts, *this, Depth);
> break;
>
> default:
> Index: include/llvm/Target/TargetLowering.h
> ===================================================================
> --- include/llvm/Target/TargetLowering.h
> +++ include/llvm/Target/TargetLowering.h
> @@ -2678,6 +2678,14 @@
> const SelectionDAG &DAG,
> unsigned Depth = 0) const;
>
> + virtual void computeKnownBitsForFrameIndex(const SDValue Op,
> + KnownBits &Known,
> + const APInt &DemandedElts,
> + const SelectionDAG &DAG,
> + unsigned Depth = 0) const {
> + return;
> + }
> +
> /// This method can be implemented by targets that want to expose additional
> /// information about sign bits to the DAG Combiner. The DemandedElts
> /// argument allows us to only collect the minimum sign bits that are shared
More information about the llvm-commits
mailing list