Skip to content

Commit 12def78

Browse files
authored
[SPIR-V] Fix asm printing of OpLifetimeStart/Stop (#155676)
There should not be a comma between the operands. `spirv-val` errors on it, and `llvm-spirv` doesn't emit it. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 1fca50d commit 12def78

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

llvm/lib/Target/SPIRV/SPIRVInstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@ let isReturn = 1, hasDelaySlot = 0, isBarrier = 0, isTerminator = 1, isNotDuplic
637637
def OpReturnValue: Op<254, (outs), (ins ID:$ret), "OpReturnValue $ret">;
638638
def OpUnreachable: SimpleOp<"OpUnreachable", 255>;
639639
}
640-
def OpLifetimeStart: Op<256, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStart $ptr, $sz">;
641-
def OpLifetimeStop: Op<257, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStop $ptr, $sz">;
640+
def OpLifetimeStart: Op<256, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStart $ptr $sz">;
641+
def OpLifetimeStop: Op<257, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStop $ptr $sz">;
642642
def OpDemoteToHelperInvocation: SimpleOp<"OpDemoteToHelperInvocation", 5380>;
643643

644644
// 3.42.18 Atomic Instructions

llvm/test/CodeGen/SPIRV/llvm-intrinsics/lifetime.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
; CL: OpFunction
1818
; CL: %[[#FooVar:]] = OpVariable
1919
; CL-NEXT: %[[#Casted1:]] = OpBitcast %[[#PtrChar]] %[[#FooVar]]
20-
; CL-NEXT: OpLifetimeStart %[[#Casted1]], 16
20+
; CL-NEXT: OpLifetimeStart %[[#Casted1]] 16
2121
; CL-NEXT: OpBitcast
2222
; CL-NEXT: OpInBoundsPtrAccessChain
2323
; CL-NEXT: %[[#Casted2:]] = OpBitcast %[[#PtrChar]] %[[#FooVar]]
24-
; CL-NEXT: OpLifetimeStop %[[#Casted2]], 16
24+
; CL-NEXT: OpLifetimeStop %[[#Casted2]] 16
2525

2626
; VK: OpFunction
2727
; VK: %[[#FooVar:]] = OpVariable
@@ -38,11 +38,11 @@ define spir_func void @foo(ptr noundef byval(%tprange) align 8 %_arg_UserRange)
3838
; CL: OpFunction
3939
; CL: %[[#BarVar:]] = OpVariable
4040
; CL-NEXT: %[[#Casted1:]] = OpBitcast %[[#PtrChar]] %[[#BarVar]]
41-
; CL-NEXT: OpLifetimeStart %[[#Casted1]], 16
41+
; CL-NEXT: OpLifetimeStart %[[#Casted1]] 16
4242
; CL-NEXT: OpBitcast
4343
; CL-NEXT: OpInBoundsPtrAccessChain
4444
; CL-NEXT: %[[#Casted2:]] = OpBitcast %[[#PtrChar]] %[[#BarVar]]
45-
; CL-NEXT: OpLifetimeStop %[[#Casted2]], 16
45+
; CL-NEXT: OpLifetimeStop %[[#Casted2]] 16
4646

4747
; VK: OpFunction
4848
; VK: %[[#BarVar:]] = OpVariable
@@ -58,9 +58,9 @@ define spir_func void @bar(ptr noundef byval(%tprange) align 8 %_arg_UserRange)
5858

5959
; CL: OpFunction
6060
; CL: %[[#TestVar:]] = OpVariable
61-
; CL-NEXT: OpLifetimeStart %[[#TestVar]], 1
61+
; CL-NEXT: OpLifetimeStart %[[#TestVar]] 1
6262
; CL-NEXT: OpInBoundsPtrAccessChain
63-
; CL-NEXT: OpLifetimeStop %[[#TestVar]], 1
63+
; CL-NEXT: OpLifetimeStop %[[#TestVar]] 1
6464

6565
; VK: OpFunction
6666
; VK: %[[#Test:]] = OpVariable

0 commit comments

Comments
 (0)