[PATCH] D35498: [LoopVectorizer] Use two step casting for float to pointer type.

Michael Kuperstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 13:53:17 PDT 2017


mkuper added a comment.

In https://reviews.llvm.org/D35498#811759, @rengolin wrote:

> Setting aside from the fact that no one should ever be casting floating point to pointers, perhaps we shouldn't be even trying to do this transformation here, as I'm not sure this could have a guaranteed semantics in this case, and probably better to just bail the vectorisation?


I'm not sure about this. What's happening here, if I understand correctly, is that we have a struct:

  typedef struct CvNode1D
  {
      float val;
      struct CvNode1D *next;
  }
  CvNode1D;

And we're trying to vectorize code that loads these structs. Since the pointer and the float have the same width, we can load four of the structs as, e.g. 2 * <4 x float>, and then use shuffles to get a vector of 4 floats and a vectors of 4 pointers.

Anyway, I agree this isn't the right fix, but my gut feeling is that the right fix is to actually allow the builder to create a bitcast between a pointer and a pointer-sized float.
I don't see anything in the langref that makes the semantics of this undefined. Renato, what kind of semantic issues do you see here?

> Also, tests, etc. please.

+1


https://reviews.llvm.org/D35498





More information about the llvm-commits mailing list