[PATCH] D30810: Preserve vec3 type.
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 07:04:58 PDT 2017
Anastasia added a comment.
In https://reviews.llvm.org/D30810#699827, @jaykang10 wrote:
> In https://reviews.llvm.org/D30810#699695, @bruno wrote:
> > Hi JinGu,
> > I just read the discussion on cfe-dev, some comments:
> > > My colleague and I are implementing a transformation pass between LLVM IR and another IR and we want to keep the 3-component vector types in our target IR
> > Why can't you go back through the shuffle to find out that it comes from a vec3 -> vec4 transformation? Adding a flag here just for that seems very odd.
> Hi Bruno,
> Thanks for your comment. We have a pass to undo the vec4 to vec3. I wondered why clang generates the vec4 for vec3 load/store. As you can see the comment on clang's code, they are generated for better performance. I had a questions at this point. clang should consider vector load/store aligned by 4 regardless of target??? llvm's codegen could handle vec3 according to targets' vector load/store with their alignment. I agree the flag looks odd but I was concerned some llvm's targets depend on the vec4 so I suggested to add the flag. If I missed something, please let me know.
I think doing this transformation in a frontend was not the best choice because we are losing the source information too early. But some targets can offer a better support for vec3 natively than converting to vec4. Regarding the option, I am wondering whether adding this as a part of TargetInfo would be a better solution. Although, I don't think any currently available upstream targets support this.
More information about the cfe-commits