From de60bbfea3de2565a2f696810befece301507494 Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Mon, 16 Sep 2013 13:33:23 -0700 Subject: 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 = ; break; case 2: x = ; 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 --- tools/opt/opt.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools') 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. -- cgit v1.2.3-18-g5258