LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12833 - EngineBuilder ignores mcpu/march/mattr parameters, and so does lli
Summary: EngineBuilder ignores mcpu/march/mattr parameters, and so does lli
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 09:31 PDT by Jose Fonseca
Modified: 2014-05-14 06:26 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jose Fonseca 2012-05-15 09:31:46 PDT
In LLVM 3.1, EngineBuilder is ignoring the parameters being passed to setMArch/setMCPU/setMAttrs methods.

Consequently, mcpu/march/mattr options in command line lli tool do not work.

This change fixes it:

index 42364f9..f46674d 100644
--- a/lib/ExecutionEngine/TargetSelect.cpp
+++ b/lib/ExecutionEngine/TargetSelect.cpp
@@ -26,9 +26,9 @@
 using namespace llvm;
 
 TargetMachine *EngineBuilder::selectTarget() {
-  StringRef MArch = "";
-  StringRef MCPU = "";
-  SmallVector<std::string, 1> MAttrs;
+  //StringRef MArch = "";
+  //StringRef MCPU = "";
+  //SmallVector<std::string, 1> MAttrs;
   Triple TT(M->getTargetTriple());
 
   return selectTarget(TT, MArch, MCPU, MAttrs);

I think this is a severe functionality regression for lli. So please consider fixing this for llvm 3.1
Comment 1 Jose Fonseca 2012-05-19 05:08:56 PDT
I suspect this was introduced by

commit 8e1fc56b2496270d1d6040cb648eef5d5aeb6079
Author: Owen Anderson <resistor@mac.com>
Date:   Fri Mar 23 17:40:56 2012 +0000

    Make it feasible for clients using EngineBuilder to capture the TargetMachine that is created as part of selecting the appropriate target.
    This is necessary if the client wants to be able to mutate TargetOptions (for example, fast FP math mode) after the initial creation of the ExecutionEngine.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153342 91177308-0d34-0410-b5e6-96231b3b80d8
Comment 2 Jose Fonseca 2014-05-14 06:26:05 PDT
Fixed in

commit 5b2d81bb50de40c94449b10c527228b9ebf2c35f
Author: Owen Anderson <resistor@mac.com>
Date:   Mon May 21 16:57:17 2012 +0000

    Make it so that the MArch, MCPU, MAttrs passed to EngineBuilder are actually used.
    
    Patch by Jose Fonseca.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157191 91177308-0d34-0410-b5e6-96231b3b80d8


So we can close it now.