[PATCH] D147968: [TTI][BPF]: Undo specific transform-preventing passes and add one TTI hook

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 19:36:26 PDT 2023


wenlei added a comment.

My two cents:

I think that in general honoring canonicalization is good, but it's not always a clear cut. Legality and profitability are sometimes relative, and in the case of BPF, I do think there's case to be made for mid-end to look at TTI more then what is traditionally allowed. The failure mode here is different from profitability, where you may just end up with inefficient code if you don't undo later; for BPF though, it can generate program that will be rejected by verifier (not run slower). Technically BPF backend can define what is legal for that target, i.e. one could argue that BPF target requires preserving predicates in certain form (needs to be well defined though), which would then restrict certain optimization from the mid-end.

Perhaps BPF is an uncharted territory in the sense that it's so restrictive that its requirements are often at odds with more canonicalizations, and that requiring backend to undo everything is bordering impractical. A special case grant for untraditional use of TTI may be reasonable here - we can make the reasons clear so it won't set bad precedence for others.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147968



More information about the llvm-commits mailing list