[PATCH] D86371: [CodeGenPrepare][X86] Teach optimizeGatherScatterInst to turn a splat pointer into GEP with scalar base and 0 index

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 08:59:15 PDT 2020


spatel added a subscriber: ctetreau.
spatel added inline comments.


================
Comment at: llvm/lib/Analysis/VectorUtils.cpp:345
 /// of instructions that broadcasts a scalar at element 0.
-const llvm::Value *llvm::getSplatValue(const Value *V) {
+llvm::Value *llvm::getSplatValue(const Value *V) {
   if (isa<VectorType>(V->getType()))
----------------
Inconsistent use of "llvm::" ? Not sure if there's some guideline/pref, but seems odd to see one Value use the namespace but the other does not.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5403
+
+    unsigned NumElts = cast<FixedVectorType>(Ptr->getType())->getNumElements();
+
----------------
I know we're doing this cast in the other clause too, but is there anything guarding this function from crashing with scalable vectors?
cc @ctetreau 


================
Comment at: llvm/test/CodeGen/X86/masked_gather_scatter.ll:3323
+
+define void @splat_ptr(i32* %ptr, <4 x i1> %mask, <4 x i32> %val) {
+; CHECK-LABEL: @splat_ptr(
----------------
pre-commit baseline tests?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86371/new/

https://reviews.llvm.org/D86371



More information about the llvm-commits mailing list