<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Mar 22, 2015 at 11:25 PM Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Don't worry about the repro a couple minutes of looking came across this lovely piece of code:<br><br><div><div>void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,</div><div>                                          StringRef Name, bool Enabled) {</div><div>  // FIXME: This *really* should not be here.  We need some way of translating</div><div>  // options into llvm subtarget features.</div><div>  if (Name == "sse4")</div><div>    Name = "sse4.2";</div></div><div><br></div><div>Which means I need to fix this in the driver rather than here.</div><div><br></div><div>Also, annoying FIXME. Basically you tripped on the _only_ (afaict) command line option (-msse4) that would have made this happen. :)</div></div><div dir="ltr"><div><br></div></div></blockquote><div><br></div><div>For fun btw the two options end up being something I mentioned in the original commit, we can either add the options that people put on the command line (and need to translate this) to the function signature or we add all of the features that are enabled (and have longer strings).</div><div><br></div><div>Anyhow, sorry about the breakage, I'll see what I can do to get this fixed in short order.</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>-eric</div></div><br><div class="gmail_quote">On Sun, Mar 22, 2015 at 10:57 PM Daniel Jasper <<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Mon Mar 23 00:52:28 2015<br>
New Revision: 232930<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=232930&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>pr<u></u>oject?rev=232930&view=rev</a><br>
Log:<br>
Revert "Add CodeGen support for adding cpu attributes on functions based on"<br>
<br>
This breaks CodeGen for an internal target. I'll get repro instructions<br>
to you.<br>
<br>
Removed:<br>
    cfe/trunk/test/CodeGen/<u></u>functio<u></u>n-target-features.c<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGCall.<u></u>c<u></u>pp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGCall.<u></u>c<u></u>pp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=232930&r1=232929&r2=232930&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>pr<u></u>oject/cfe/trunk/lib/CodeGen/<u></u>CG<u></u>Call.cpp?rev=232930&r1=<u></u>232929&<u></u>r2=232930&view=diff</a><br>
==============================<u></u><u></u>==============================<u></u><u></u>==================<br>
--- cfe/trunk/lib/CodeGen/CGCall.<u></u>c<u></u>pp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGCall.<u></u>c<u></u>pp Mon Mar 23 00:52:28 2015<br>
@@ -31,7 +31,6 @@<br>
 #include "llvm/IR/InlineAsm.h"<br>
 #include "llvm/IR/Intrinsics.h"<br>
 #include "llvm/Transforms/Utils/Local.<u></u>h<u></u>"<br>
-#include <sstream><br>
 using namespace clang;<br>
 using namespace CodeGen;<br>
<br>
@@ -1476,26 +1475,6 @@ void CodeGenModule::<u></u>ConstructAttrib<u></u>uteLi<br>
<br>
     if (!CodeGenOpts.<u></u>StackRealignment<u></u>)<br>
       FuncAttrs.addAttribute("no-<u></u>re<u></u>align-stack");<br>
-<br>
-    // Add target-cpu and target-features work if they differ from the defaults.<br>
-    std::string &CPU = getTarget().getTargetOpts().<u></u>CP<u></u>U;<br>
-    if (CPU != "" && CPU != getTarget().getTriple().<u></u>getArc<u></u>hName())<br>
-      FuncAttrs.addAttribute("<u></u>target<u></u>-cpu", getTarget().getTargetOpts().<u></u>CP<u></u>U);<br>
-<br>
-    // TODO: FeaturesAsWritten gets us the features on the command line,<br>
-    // for canonicalization purposes we might want to avoid putting features<br>
-    // in the target-features set if we know it'll be one of the default<br>
-    // features in the backend, e.g. corei7-avx and +avx.<br>
-    std::vector<std::string> &Features =<br>
-      getTarget().getTargetOpts().<u></u>Fe<u></u>aturesAsWritten;<br>
-    if (!Features.empty()) {<br>
-      std::stringstream S;<br>
-      std::copy(Features.begin(), Features.end(),<br>
-                std::ostream_iterator<std::<u></u>str<u></u>ing>(S, ","));<br>
-      // The drop_back gets rid of the trailing space.<br>
-      FuncAttrs.addAttribute("<u></u>target<u></u>-features",<br>
-                             StringRef(S.str()).drop_back(<u></u><u></u>1));<br>
-    }<br>
   }<br>
<br>
   ClangToLLVMArgMapping IRFunctionArgs(getContext(), FI);<br>
<br>
Removed: cfe/trunk/test/CodeGen/<u></u>functio<u></u>n-target-features.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-target-features.c?rev=232929&view=auto" target="_blank">http://llvm.org/viewvc/llvm-<u></u>pr<u></u>oject/cfe/trunk/test/<u></u>CodeGen/<u></u>function-target-<u></u>features.c?<u></u>rev=232929&view=<u></u>auto</a><br>
==============================<u></u><u></u>==============================<u></u><u></u>==================<br>
--- cfe/trunk/test/CodeGen/<u></u>functio<u></u>n-target-features.c (original)<br>
+++ cfe/trunk/test/CodeGen/<u></u>functio<u></u>n-target-features.c (removed)<br>
@@ -1,21 +0,0 @@<br>
-// This test verifies that we produce target-cpu and target-features attributes<br>
-// on functions when they're different from the standard cpu and have written<br>
-// features.<br>
-<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-FEATURE<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-NO-CPU<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f -target-feature +avx512er | FileCheck %s -check-prefix=TWO-AVX<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 | FileCheck %s -check-prefix=CORE-CPU<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 -target-feature +avx | FileCheck %s -check-prefix=CORE-CPU-AND-<u></u>FEA<u></u>TURES<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU-NOT<br>
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7-avx -target-feature -avx | FileCheck %s -check-prefix=AVX-MINUS-<u></u>FEATUR<u></u>E<br>
-<br>
-void foo() {}<br>
-<br>
-// AVX-FEATURE: "target-features"="+avx"<br>
-// AVX-NO-CPU-NOT: target-cpu<br>
-// TWO-AVX: "target-features"="+avx512f,+<u></u>a<u></u>vx512er"<br>
-// CORE-CPU: "target-cpu"="corei7"<br>
-// CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"="+avx"<br>
-// X86-64-CPU-NOT: "target-cpu"<br>
-// AVX-MINUS-FEATURE: "target-features"="-avx"<br>
<br>
<br>
______________________________<u></u><u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailm<u></u>an/listinfo/cfe-commits</a><br>
</blockquote></div></blockquote></div></div>