[llvm-commits] [llvm] r167011 - in /llvm/trunk: include/llvm/Target/TargetTransformImpl.h include/llvm/TargetTransformInfo.h include/llvm/Transforms/Utils/Local.h lib/Target/TargetTransformImpl.cpp lib/Transforms/Scalar/CodeGenPrepare.cpp lib/Transforms/Scalar/SimplifyCFGPass.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/CodeGen/SPARC/load_to_switch.ll test/Transforms/SimplifyCFG/SPARC/ test/Transforms/SimplifyCFG/SPARC/lit.local.cfg test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll
Hans Wennborg
hans at chromium.org
Wed Nov 7 08:20:30 PST 2012
On Tue, Nov 6, 2012 at 11:04 PM, Andrew Trick <atrick at apple.com> wrote:
> /// replace the switch with lookup tables.
> static bool SwitchToLookupTable(SwitchInst *SI,
> IRBuilder<> &Builder,
> - const DataLayout* TD) {
> + const DataLayout* TD,
> + const TargetTransformInfo *TTI) {
> assert(SI->getNumCases() > 1 && "Degenerate switch?");
> +
> + if (TTI &&
> !TTI->getScalarTargetTransformInfo()->shouldBuildLookupTables())
> + return false;
> +
>
>
> Hi Hans,
>
> The two cases above assume that lookup tables should be generated whenever
> TargetTransformInfo is missing or unspecified. It is important to be able to
> run the opt tool without target information and later rerun certain
> optimizations for a specific target, or simply run the code generator.
I guess I hadn't thought about that use case. I chose to enable it by
default since my understanding was that the transformation is generic,
except for certain targets where it's bad.
I'm happy to reverse the logic (default to no lookup tables) if people
agree that's the best way.
Thanks,
Hans
More information about the llvm-commits
mailing list