Skip to content

Commit 032f93c

Browse files
authored
Update for nocapture to captures(none) Attribute change (KhronosGroup#2980)
Update after llvm-project commit 29441e4f5fa5 ("[IR] Convert from nocapture to captures(none) (#123181)", 2025-01-29). This includes a bulk replacement `s/nocapture/captures(none)/g` in the test files. A few of the `captures` attributes in CHECK lines had to be reordered manually. XFAIL two tests
1 parent 6675e28 commit 032f93c

File tree

112 files changed

+278
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+278
-268
lines changed

lib/SPIRV/SPIRVInternal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ inline void SPIRVMap<Attribute::AttrKind, SPIRVFuncParamAttrKind>::init() {
239239
add(Attribute::ByVal, FunctionParameterAttributeByVal);
240240
add(Attribute::StructRet, FunctionParameterAttributeSret);
241241
add(Attribute::NoAlias, FunctionParameterAttributeNoAlias);
242-
add(Attribute::NoCapture, FunctionParameterAttributeNoCapture);
243242
add(Attribute::ReadOnly, FunctionParameterAttributeNoWrite);
244243
add(Attribute::ReadNone, FunctionParameterAttributeNoReadWrite);
245244
}

lib/SPIRV/SPIRVReader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,6 +3223,11 @@ void SPIRVToLLVM::transFunctionAttrs(SPIRVFunction *BF, Function *F) {
32233223
// OpenCL metadata
32243224
if (Kind == FunctionParameterAttributeRuntimeAlignedINTEL)
32253225
return;
3226+
if (Kind == FunctionParameterAttributeNoCapture) {
3227+
I->addAttr(Attribute::getWithCaptureInfo(F->getContext(),
3228+
CaptureInfo::none()));
3229+
return;
3230+
}
32263231
Attribute::AttrKind LLVMKind = SPIRSPIRVFuncParamAttrMap::rmap(Kind);
32273232
if (IllegalAttrs.contains(LLVMKind))
32283233
return;

lib/SPIRV/SPIRVRegularizeLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void SPIRVRegularizeLLVMBase::lowerIntrinsicToFunction(
101101
Intrinsic->setCalledFunction(F);
102102
return;
103103
}
104-
// TODO copy arguments attributes: nocapture writeonly.
104+
// TODO copy arguments attributes: captures(none) writeonly.
105105
FunctionCallee FC =
106106
M->getOrInsertFunction(FuncName, Intrinsic->getFunctionType());
107107
auto IntrinsicID = Intrinsic->getIntrinsicID();

test/DebugInfo/Generic/2010-10-01-crash.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ entry:
1515

1616
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
1717

18-
declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
18+
declare void @llvm.memcpy.p0.p0.i32(ptr captures(none), ptr captures(none), i32, i1) nounwind
1919

2020

2121
!llvm.dbg.cu = !{!2}

test/DebugInfo/Generic/c-and-cpp-mixed.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818

1919
; CHECK-LLVM: define spir_func void @foo() #0 !dbg ![[#Func1:]] {
2020
; CHECK-LLVM: entry:
21-
; CHECK-LLVM: %puts = call spir_func i32 @puts(ptr addrspace(1) nocapture @str) #0, !dbg ![[#Puts1Loc:]]
21+
; CHECK-LLVM: %puts = call spir_func i32 @puts(ptr addrspace(1) captures(none) @str) #0, !dbg ![[#Puts1Loc:]]
2222
; CHECK-LLVM: ret void, !dbg ![[#Ret1:]]
2323
; CHECK-LLVM: }
2424

25-
; CHECK-LLVM: define spir_func i32 @main(i32 %argc, ptr nocapture %argv) #0 !dbg ![[#Func2:]] {
25+
; CHECK-LLVM: define spir_func i32 @main(i32 %argc, ptr captures(none) %argv) #0 !dbg ![[#Func2:]] {
2626
; CHECK-LLVM: entry:
2727
; CHECK-LLVM: #dbg_value(i32 %argc, ![[#Fun2Param1:]], !DIExpression(), ![[#Fun2Param1Loc:]])
2828
; CHECK-LLVM: #dbg_value(ptr %argv, ![[#Fun2Param2:]], !DIExpression(DW_OP_deref, DW_OP_deref), ![[#Fun2Param2Loc:]])
2929
; CHECK-LLVM: %0 = bitcast ptr addrspace(1) @str1 to ptr addrspace(1), !dbg ![[#Puts2Loc:]]
30-
; CHECK-LLVM: %puts = call spir_func i32 @puts(ptr addrspace(1) nocapture %0) #0, !dbg ![[#Puts2Loc]]
30+
; CHECK-LLVM: %puts = call spir_func i32 @puts(ptr addrspace(1) captures(none) %0) #0, !dbg ![[#Puts2Loc]]
3131
; CHECK-LLVM: call spir_func void @foo() #0, !dbg ![[#CallFoo:]]
3232
; CHECK-LLVM: ret i32 0, !dbg ![[#Ret2:]]
3333
; CHECK-LLVM: }
@@ -74,9 +74,9 @@ entry:
7474
ret void, !dbg !25
7575
}
7676

77-
declare i32 @puts(ptr addrspace(1) nocapture) nounwind
77+
declare i32 @puts(ptr addrspace(1) captures(none)) nounwind
7878

79-
define i32 @main(i32 %argc, ptr nocapture %argv) nounwind !dbg !12 {
79+
define i32 @main(i32 %argc, ptr captures(none) %argv) nounwind !dbg !12 {
8080
entry:
8181
tail call void @llvm.dbg.value(metadata i32 %argc, metadata !21, metadata !DIExpression()), !dbg !26
8282
; Avoid talking about the pointer size in debug info because that's target dependent

test/DebugInfo/Generic/debug-info-eis-option.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ target triple = "spir64-unknown-unknown"
1515
source_filename = "linear-dbg-value.ll"
1616

1717
; Function Attrs: nounwind readonly uwtable
18-
define i32 @foo(ptr nocapture readonly %a, i32 %N) local_unnamed_addr #0 !dbg !6 {
18+
define i32 @foo(ptr captures(none) readonly %a, i32 %N) local_unnamed_addr #0 !dbg !6 {
1919
entry:
2020
%cmp6 = icmp sgt i32 %N, 0, !dbg !11
2121
br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup, !dbg !15

test/DebugInfo/Generic/linear-dbg-value.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ target triple = "spir64-unknown-unknown"
1515
source_filename = "linear-dbg-value.ll"
1616

1717
; Function Attrs: nounwind readonly uwtable
18-
define i32 @foo(ptr nocapture readonly %a, i32 %N) local_unnamed_addr #0 !dbg !6 {
18+
define i32 @foo(ptr captures(none) readonly %a, i32 %N) local_unnamed_addr #0 !dbg !6 {
1919
entry:
2020
%cmp6 = icmp sgt i32 %N, 0, !dbg !11
2121
br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup, !dbg !15

test/DebugInfo/Generic/two-cus-from-same-file.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ entry:
2626
ret void, !dbg !25
2727
}
2828

29-
declare i32 @puts(ptr addrspace(1) nocapture) nounwind
29+
declare i32 @puts(ptr addrspace(1) captures(none)) nounwind
3030

31-
define i32 @main(i32 %argc, ptr nocapture %argv) nounwind !dbg !12 {
31+
define i32 @main(i32 %argc, ptr captures(none) %argv) nounwind !dbg !12 {
3232
entry:
3333
tail call void @llvm.dbg.value(metadata i32 %argc, metadata !21, metadata !DIExpression()), !dbg !26
3434
; Avoid talking about the pointer size in debug info because that's target dependent

test/DebugInfo/NonSemantic/Shader200/FortranComplex.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ alloca_0:
7373
ret void, !dbg !16
7474
}
7575

76-
declare !llfort.intrin_id !17 !llfort.type_idx !18 i32 @for_set_fpe_(ptr addrspace(1) nocapture readonly) local_unnamed_addr
76+
declare !llfort.intrin_id !17 !llfort.type_idx !18 i32 @for_set_fpe_(ptr addrspace(1) captures(none) readonly) local_unnamed_addr
7777

7878
; Function Attrs: nofree
79-
declare !llfort.intrin_id !19 !llfort.type_idx !20 i32 @for_set_reentrancy(ptr addrspace(1) nocapture readonly) local_unnamed_addr
79+
declare !llfort.intrin_id !19 !llfort.type_idx !20 i32 @for_set_reentrancy(ptr addrspace(1) captures(none) readonly) local_unnamed_addr
8080

8181
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
8282
declare void @llvm.dbg.value(metadata, metadata, metadata)

test/DebugInfo/RecursiveDebugInfo.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ entry:
7474
}
7575

7676
; Function Attrs: argmemonly nounwind willreturn
77-
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
77+
declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #1
7878

7979
; Function Attrs: nounwind readnone speculatable willreturn
8080
declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
@@ -99,7 +99,7 @@ entry:
9999
}
100100

101101
; Function Attrs: argmemonly nounwind willreturn
102-
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
102+
declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #1
103103

104104
; Function Attrs: nounwind
105105
define linkonce_odr dso_local spir_func void @_ZN8iteratorI6vectorEC2Ev(ptr addrspace(4) %this) unnamed_addr #4 comdat align 2 !dbg !62 {

0 commit comments

Comments
 (0)