[llvm-dev] does clang plan to match gcc's pointer-to-vector-element feature?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 3 19:46:24 PST 2019


https://godbolt.org/z/hSnOuW

Two questions:

(1) is it planned for GEP to work on vector elements?

(2) do vectors have a well-defined in-memory layout?


I see that [1] says:

> This hasn’t always been forcefully disallowed, though it’s not
recommended. It leads to awkward special cases in the optimizers, and
fundamental inconsistency in the IR. In the future, it will probably be
outright disallowed.

[1]:
http://llvm.org/docs/GetElementPtr.html#can-gep-index-into-vector-elements


However please take a look at the godbolt link. If clang wants to match
feature parity of gcc, then (1) or (2) must be utilized.

What's the plan? I'm trying to implement this feature in Zig but it
seems that LLVM IR does not provide enough guarantees for this feature
to be sound.

Thanks for the advice,
Andrew


More information about the llvm-dev mailing list