[commit: ghc] master: Do not supply `-mcpu` if `-optlc` provides `-mcpu` already. (cb1ee7e)

git at git.haskell.org git at git.haskell.org
Sat May 5 17:27:43 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/cb1ee7e10e50b11b4a24e56b425e8f3485d298d5/ghc

>---------------------------------------------------------------

commit cb1ee7e10e50b11b4a24e56b425e8f3485d298d5
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Fri May 4 14:39:16 2018 -0400

    Do not supply `-mcpu` if `-optlc` provides `-mcpu` already.
    
    Reviewers: bgamari
    
    Subscribers: thomie, carter
    
    GHC Trac Issues: #14982
    
    Differential Revision: https://phabricator.haskell.org/D4548


>---------------------------------------------------------------

cb1ee7e10e50b11b4a24e56b425e8f3485d298d5
 compiler/main/DriverPipeline.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 2789ee4..1d78bee 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -70,7 +70,7 @@ import System.Directory
 import System.FilePath
 import System.IO
 import Control.Monad
-import Data.List        ( isSuffixOf, intercalate )
+import Data.List        ( isInfixOf, isSuffixOf, intercalate )
 import Data.Maybe
 import Data.Version
 import Data.Either      ( partitionEithers )
@@ -823,7 +823,8 @@ llvmOptions dflags =
     ++ [("", "-filetype=obj") | fastLlvmPipeline dflags ]
 
     -- Additional llc flags
-    ++ [("", "-mcpu=" ++ mcpu)   | not (null mcpu) ]
+    ++ [("", "-mcpu=" ++ mcpu)   | not (null mcpu)
+                                 , not (any (isInfixOf "-mcpu") (getOpts dflags opt_lc)) ]
     ++ [("", "-mattr=" ++ attrs) | not (null attrs) ]
 
   where target = LLVM_TARGET



More information about the ghc-commits mailing list