r239580 - Add support for tune= to the target attribute support by ignoring it.

Eric Christopher echristo at gmail.com
Thu Jun 11 18:35:56 PDT 2015


Author: echristo
Date: Thu Jun 11 20:35:56 2015
New Revision: 239580

URL: http://llvm.org/viewvc/llvm-project?rev=239580&view=rev
Log:
Add support for tune= to the target attribute support by ignoring it.

We don't currently support the -mtune option in any useful way
so ignoring the annotation is fine.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/test/CodeGen/attr-target.c

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=239580&r1=239579&r2=239580&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Jun 11 20:35:56 2015
@@ -1512,6 +1512,9 @@ void CodeGenModule::ConstructAttributeLi
           // While we're here iterating check for a different target cpu.
           if (Feature.startswith("arch="))
             TargetCPU = Feature.split("=").second;
+	  else if (Feature.startswith("tune="))
+	    // We don't support cpu tuning this way currently.
+	    ;
 	  else
 	    Features.push_back("+" + Feature.str());
 	}

Modified: cfe/trunk/test/CodeGen/attr-target.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-target.c?rev=239580&r1=239579&r2=239580&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/attr-target.c (original)
+++ cfe/trunk/test/CodeGen/attr-target.c Thu Jun 11 20:35:56 2015
@@ -4,11 +4,15 @@ int baz(int a) { return 4; }
 
 int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo(int a) { return 4; }
 
+int __attribute__((target("tune=sandybridge"))) walrus(int a) { return 4; }
+
 int bar(int a) { return baz(a) + foo(a); }
 
 // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar.
 // CHECK: baz{{.*}} #0
 // CHECK: foo{{.*}} #1
+// We ignore the tune attribute so walrus should be identical to baz and bar.
+// CHECK: walrus{{.*}} #0
 // CHECK: bar{{.*}} #0
 // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2"
 // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+sse,+sse2,+avx,+sse4.2"





More information about the cfe-commits mailing list