[llvm-commits] [Patch] Use TargetTransformInfo to control switch-to-lookup table transform

Hans Wennborg hans at chromium.org
Mon Oct 29 10:02:04 PDT 2012


On Mon, Oct 29, 2012 at 4:49 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> Well, there is a rather obvious issue with the way it is implemented:
> whether a target supports jump tables is mostly unrelated to whether
> it supports lookup tables.

It's not entirely unrelated, though. Based on the discussion [1] when
the transform first landed, I got the impression that targets that do
not want unexpected new global memory allocations wouldn't want jump
tables either.

If a target supports jump tables, a lookup table is strictly better,
so I figured this was a good heuristic.

Having said that, I would actually prefer if we could just always
default this to "true", and the relevant targets, which ones I don't
know, would turn it off explicitly. Someone would have to give me an
example of such a target so I can add a test, though.

Thanks,
Hans

[1]. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120910/150207.html



More information about the llvm-commits mailing list