[llvm] [X86] matchAddressRecursively - move ZERO_EXTEND patterns into matchIndexRecursively (PR #85081)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 20:51:25 PDT 2024


================
@@ -2278,18 +2278,20 @@ static bool foldMaskedShiftToBEXTR(SelectionDAG &DAG, SDValue N,
   return false;
 }
 
-// Attempt to peek further into a scaled index register, collecting additional
-// extensions / offsets / etc. Returns /p N if we can't peek any further.
-SDValue X86DAGToDAGISel::matchIndexRecursively(SDValue N,
-                                               X86ISelAddressMode &AM,
-                                               unsigned Depth) {
+// Change the return type of matchIndexRecursively to std::optional<SDValue> to
+// make it easier for caller to tell whether the match is successful. Attempt to
+// peek further into a scaled index register, collecting additional extensions /
+// offsets / etc. Returns /p N if we can't peek any further.
+std::optional<SDValue>
----------------
topperc wrote:

I didn't look too closely at that patch. Do we need a std::optional here? SDValue already has an empty state, can't we use that like we normally do in SelectionDAG?

https://github.com/llvm/llvm-project/pull/85081


More information about the llvm-commits mailing list