[llvm] [CFG] Simplify gather/scatter splat pointer matching (PR #145931)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 11:03:10 PDT 2025


================
@@ -4888,14 +4888,9 @@ static bool getUniformBase(const Value *Ptr, SDValue &Base, SDValue &Index,
 
   assert(Ptr->getType()->isVectorTy() && "Unexpected pointer type");
 
-  // Handle splat constant pointer.
-  if (auto *C = dyn_cast<Constant>(Ptr)) {
-    C = C->getSplatValue();
-    if (!C)
-      return false;
-
-    Base = SDB->getValue(C);
-
+  // Handle splat (possibly constant) pointer.
+  if (Value *ScalarV = getSplatValue(Ptr)) {
----------------
preames wrote:

Oh yuck, I should have checked the history here more closely.  No, it doesn't.  

I'm going to close this and revisit from scratch.  I can probably find an analogous approach, but TBD.

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


More information about the llvm-commits mailing list