jgorbe added a comment.

This breaks some existing code (we have found this issue building the JPEG XL 
library at github.com/libjxl). This is a very simplified version of the problem:

  #pragma clang attribute push(__attribute__((target("sse2,ssse3"))), apply_to 
= function)
  __attribute__((target("sse2"))) void f() {
  }
  #pragma clang attribute pop

This used to build before this patch, but now fails with

  $ clang -c a.cc
  a.cc:1:45: error: attribute 'target' cannot appear more than once on a 
declaration
  #pragma clang attribute push(__attribute__((target("sse2,ssse3"))), apply_to 
= function)
                                              ^
  a.cc:2:1: note: when applied to this declaration
  __attribute__((target("sse2"))) void f() {
  ^
  a.cc:2:16: note: conflicting attribute is here
  __attribute__((target("sse2"))) void f() {
                 ^
  1 error generated.

Before this patch, the function-level attribute would win. Here's the relevant 
part of the generated IR for that example:

  ; Function Attrs: mustprogress noinline nounwind optnone uwtable
  define dso_local void @_Z1fv() #0 {
    ret void
  }
  
  attributes #0 = { mustprogress noinline nounwind optnone uwtable 
"frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" 
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" 
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

Note how there's `sse2` (which was in the function-level attribute) but no 
`ssse3` (which wasn't).

Was this semantic change intentional?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51650/new/

https://reviews.llvm.org/D51650

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to