aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJan Voung <jvoung@chromium.org>2013-09-16 13:33:23 -0700
committerJan Voung <jvoung@chromium.org>2013-09-16 13:33:23 -0700
commitde60bbfea3de2565a2f696810befece301507494 (patch)
tree9cad8284e5389eb8dcf938a7a6dc4116c34d2eeb /tools
parent591359fae065fb5f86ba957a550503daef727536 (diff)
Use ARM TTI in "opt" to make up for missing LE32 TTI.
Since we deleted the rewrite of ARM -> LE32 in the bitcode reader, opt is unable to look up a TTI to transform switch(c) { case 1: x = <const1>; break; case 2: x = <const2>; break; ... } into a lookup table to get x from c. This causes a regression in pnacl-llc's size (which has lots of switch statements). Fake the target lookup in opt for now. Eventually we should look into making target info for le32. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2554 TEST= trybot http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/887 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/842 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/23551013
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/opt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 6386b6b9e3..e0ea24a9d8 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -552,6 +552,14 @@ CodeGenOpt::Level GetCodeGenOptLevel() {
// Returns the TargetMachine instance or zero if no triple is provided.
static TargetMachine* GetTargetMachine(Triple TheTriple) {
std::string Error;
+ // @LOCALMOD-BEGIN: Some optimization passes like SimplifyCFG do nice
+ // things for code size, but only do it if the TTI says it is okay.
+ // For now, use the ARM TTI for LE32 until we have an LE32 TTI.
+ // https://code.google.com/p/nativeclient/issues/detail?id=2554
+ if (TheTriple.getArch() == Triple::le32) {
+ TheTriple.setArchName("armv7a");
+ }
+ // @LOCALMOD-END
const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple,
Error);
// Some modules don't specify a triple, and this is okay.