Skip to content

Commit 44cc121

Browse files
when merging, use the attribute from the declaration
1 parent fa77646 commit 44cc121

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5137,9 +5137,12 @@ Sema::MergeSYCLIntelESimdVectorizeAttr(Decl *D,
51375137
if (DeclExpr->getResultAsAPSInt() != MergeExpr->getResultAsAPSInt()) {
51385138
Diag(DeclAttr->getLoc(), diag::warn_duplicate_attribute) << &A;
51395139
Diag(A.getLoc(), diag::note_previous_attribute);
5140+
// Drop the attribute from the current declaration
5141+
D->dropAttr<SYCLIntelESimdVectorizeAttr>();
5142+
} else {
5143+
// Do not add a duplicate attribute.
5144+
return nullptr;
51405145
}
5141-
// Do not add a duplicate attribute.
5142-
return nullptr;
51435146
}
51445147
}
51455148
}

clang/test/CodeGenSYCL/esimd-vectorize-md.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
[[intel::sycl_esimd_vectorize(8)]] __attribute__((sycl_device)) void foo3();
1313
[[intel::sycl_esimd_vectorize(16)]] __attribute__((sycl_device)) void foo3() {}
14-
// CHECK: @_Z4foo3v() #[[ATTR3:[0-9]+]]
14+
// CHECK: @_Z4foo3v() #[[ATTR2]]
1515

1616
// CHECK: attributes #[[ATTR1]] = { {{.*}} "CMGenxSIMT"="32" {{.*}}}
1717
// CHECK: attributes #[[ATTR2]] = { {{.*}} "CMGenxSIMT"="8" {{.*}}}
18-
// CHECK: attributes #[[ATTR3]] = { {{.*}} "CMGenxSIMT"="16" {{.*}}}

0 commit comments

Comments
 (0)