[llvm-commits] [llvm] r134986 - in /llvm/trunk/test/CodeGen/Thumb2: thumb2-bcc.ll thumb2-branch.ll

Jim Grosbach grosbach at apple.com
Tue Jul 12 09:06:01 PDT 2011


Author: grosbach
Date: Tue Jul 12 11:06:01 2011
New Revision: 134986

URL: http://llvm.org/viewvc/llvm-project?rev=134986&view=rev
Log:
Improve test cases from r134746.

Use memory barriers to force if-conversion off for these tests instead of
the internal llc command line option ifcvt-limit.

Modified:
    llvm/trunk/test/CodeGen/Thumb2/thumb2-bcc.ll
    llvm/trunk/test/CodeGen/Thumb2/thumb2-branch.ll

Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-bcc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-bcc.ll?rev=134986&r1=134985&r2=134986&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/thumb2-bcc.ll (original)
+++ llvm/trunk/test/CodeGen/Thumb2/thumb2-bcc.ll Tue Jul 12 11:06:01 2011
@@ -1,7 +1,8 @@
-; RUN: llc < %s -ifcvt-limit=0 -march=thumb -mattr=+thumb2 | FileCheck %s
-; RUN: llc < %s -ifcvt-limit=0 -march=thumb -mattr=+thumb2 | not grep it
+; RUN: llc < %s -march=thumb -mattr=+thumb2 | FileCheck %s
+; RUN: llc < %s -march=thumb -mattr=+thumb2 | not grep it
 ; If-conversion defeats the purpose of this test, which is to check CBZ
-; generation, so turn it off.
+; generation, so use memory barrier instruction to make sure it doesn't
+; happen and we get actual branches.
 
 define i32 @t1(i32 %a, i32 %b, i32 %c) {
 ; CHECK: t1:
@@ -10,12 +11,16 @@
 	br i1 %tmp2, label %cond_false, label %cond_true
 
 cond_true:
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
 	%tmp5 = add i32 %b, 1
         %tmp6 = and i32 %tmp5, %c
 	ret i32 %tmp6
 
 cond_false:
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
 	%tmp7 = add i32 %b, -1
         %tmp8 = xor i32 %tmp7, %c
 	ret i32 %tmp8
 }
+
+declare void @llvm.memory.barrier(i1, i1, i1, i1, i1) nounwind

Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-branch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-branch.ll?rev=134986&r1=134985&r2=134986&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/thumb2-branch.ll (original)
+++ llvm/trunk/test/CodeGen/Thumb2/thumb2-branch.ll Tue Jul 12 11:06:01 2011
@@ -1,6 +1,7 @@
-; RUN: llc < %s -ifcvt-limit=0 -mtriple=thumbv7-apple-darwin -mattr=+thumb2 | FileCheck %s
+; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+thumb2 | FileCheck %s
 ; If-conversion defeats the purpose of this test, which is to check conditional
-; branch generation, so turn it off.
+; branch generation, so use memory barrier instruction to make sure it doesn't
+; happen and we get actual branches.
 
 define i32 @f1(i32 %a, i32 %b, i32* %v) {
 entry:
@@ -10,10 +11,12 @@
         br i1 %tmp, label %cond_true, label %return
 
 cond_true:              ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         store i32 0, i32* %v
         ret i32 0
 
 return:         ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         ret i32 1
 }
 
@@ -25,10 +28,12 @@
         br i1 %tmp, label %cond_true, label %return
 
 cond_true:              ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         store i32 0, i32* %v
         ret i32 0
 
 return:         ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         ret i32 1
 }
 
@@ -40,10 +45,12 @@
         br i1 %tmp, label %cond_true, label %return
 
 cond_true:              ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         store i32 0, i32* %v
         ret i32 0
 
 return:         ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         ret i32 1
 }
 
@@ -55,9 +62,13 @@
         br i1 %tmp, label %return, label %cond_true
 
 cond_true:              ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         store i32 0, i32* %v
         ret i32 0
 
 return:         ; preds = %entry
+        call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
         ret i32 1
 }
+
+declare void @llvm.memory.barrier(i1, i1, i1, i1, i1) nounwind





More information about the llvm-commits mailing list