[llvm] [X86][APX] Avoid generating illegal MI_ND ndd instructions (PR #78233)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 17:48:10 PST 2024


================
@@ -2923,6 +2926,38 @@ bool X86DAGToDAGISel::selectAddr(SDNode *Parent, SDValue N, SDValue &Base,
   return true;
 }
 
+/// Returns true if it is able to pattern match an addressing mode with no
+/// segment reg prefix. It returns the operands which make up the maximal
+/// addressing mode it can match by reference.
+bool X86DAGToDAGISel::selectNoSegADDRAddr(SDNode *Parent, SDValue N,
+                                          SDValue &Base, SDValue &Scale,
+                                          SDValue &Index, SDValue &Disp,
+                                          SDValue &Segment) {
+  X86ISelAddressMode AM;
+
+  if (Parent) {
+    unsigned AddrSpace =
+        cast<MemSDNode>(Parent)->getPointerInfo().getAddrSpace();
+    if (AddrSpace == X86AS::GS || AddrSpace == X86AS::FS ||
+        AddrSpace == X86AS::SS)
+      return false;
----------------
KanRobert wrote:

Why we not check other segment prefixes here?

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


More information about the llvm-commits mailing list