[PATCH] D17319: [NVPTX] Test that MachineSink won't sink across llvm.cuda.syncthreads.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 09:51:28 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261114: [NVPTX] Test that MachineSink won't sink across llvm.cuda.syncthreads. (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D17319?vs=48134&id=48208#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17319

Files:
  llvm/trunk/test/CodeGen/NVPTX/MachineSink-convergent.ll

Index: llvm/trunk/test/CodeGen/NVPTX/MachineSink-convergent.ll
===================================================================
--- llvm/trunk/test/CodeGen/NVPTX/MachineSink-convergent.ll
+++ llvm/trunk/test/CodeGen/NVPTX/MachineSink-convergent.ll
@@ -0,0 +1,23 @@
+; RUN: llc < %s | FileCheck %s
+target triple = "nvptx64-nvidia-cuda"
+
+declare void @llvm.cuda.syncthreads()
+
+; Load a value, then syncthreads.  Branch, and use the loaded value only on one
+; side of the branch.  The load shouldn't be sunk beneath the call, because
+; syncthreads is modeled as maystore.
+define i32 @f(i32 %x, i32* %ptr, i1 %cond) {
+Start:
+  ; CHECK: ld.u32
+  %ptr_val = load i32, i32* %ptr
+  ; CHECK: bar.sync
+  call void @llvm.cuda.syncthreads()
+  br i1 %cond, label %L1, label %L2
+L1:
+  %ptr_val2 = add i32 %ptr_val, 100
+  br label %L2
+L2:
+  %v4 = phi i32 [ %x, %Start ], [ %ptr_val2, %L1 ]
+  %v5 = add i32 %v4, 1000
+  ret i32 %v5
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17319.48208.patch
Type: text/x-patch
Size: 942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160217/ab5d9750/attachment.bin>


More information about the llvm-commits mailing list