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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 10:26:18 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)) {
----------------
topperc wrote:

Does this work if the splat instruction isn't in the same basic block? You have to be careful looking through instructions in SelectinDAGBuilder because the Value* won't be exported from the producing basic block.

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


More information about the llvm-commits mailing list