[llvm-branch-commits] [llvm] [SelectionDAG][X86] Remove unused elements from atomic vector. (PR #125432)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 8 08:56:27 PDT 2025


================
@@ -7230,6 +7234,20 @@ static bool findEltLoadSrc(SDValue Elt, LoadSDNode *&Ld, int64_t &ByteOffset) {
       }
     }
     break;
+  case ISD::EXTRACT_ELEMENT:
+    if (auto *IdxC = dyn_cast<ConstantSDNode>(Elt.getOperand(1))) {
----------------
arsenm wrote:

> If it isn't a constant, shall we assert false or abort the transform?

Ignore it as a possibility and just let it crash. No efforts should be made to support invalid constructs 

> Why do we want to avoid EXTRACT_ELEMENT? It seems to work here.

Of course it works, but seems poorly supported by optimizations. In particular the comment on it says "This is only for use before legalization, for values that will be broken into multiple registers.". This is use during legalization (dont' really know why we have this, or this fake restriction documented). You could get the same with just shifts.

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


More information about the llvm-branch-commits mailing list