Use TargetTransformInfo to control switch-to-lookup table transformation
authorHans Wennborg <hans@hanshq.net>
Tue, 30 Oct 2012 11:23:25 +0000 (11:23 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 30 Oct 2012 11:23:25 +0000 (11:23 +0000)
commit04d7d13d301df66f6c232e41611145c062183bf3
tree506f923fd1e30024c1b3be9b63fcdb46f52d1f1b
parentc588e0e162fa08c81558871fb0c50fb51569afe3
Use TargetTransformInfo to control switch-to-lookup table transformation

When the switch-to-lookup tables transform landed in SimplifyCFG, it
was pointed out that this could be inappropriate for some targets.
Since there was no way at the time for the pass to know anything about
the target, an awkward reverse-transform was added in CodeGenPrepare
that turned lookup tables back into switches for some targets.

This patch uses the new TargetTransformInfo to determine if a
switch should be transformed, and removes
CodeGenPrepare::ConvertLoadToSwitch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167011 91177308-0d34-0410-b5e6-96231b3b80d8
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 [deleted file]
test/Transforms/SimplifyCFG/SPARC/lit.local.cfg [new file with mode: 0644]
test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll [new file with mode: 0644]