[llvm] 73855e4 - [X86] Add test case for opposite branch condition for PR44412. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 31 11:00:41 PST 2019


Author: Craig Topper
Date: 2019-12-31T10:58:04-08:00
New Revision: 73855e43009bdd433c648e7102f122365e50e398

URL: https://github.com/llvm/llvm-project/commit/73855e43009bdd433c648e7102f122365e50e398
DIFF: https://github.com/llvm/llvm-project/commit/73855e43009bdd433c648e7102f122365e50e398.diff

LOG: [X86] Add test case for opposite branch condition for PR44412. NFC

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/pr44412.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/pr44412.ll b/llvm/test/CodeGen/X86/pr44412.ll
index 9a7c5ec00bed..38d11edbf739 100644
--- a/llvm/test/CodeGen/X86/pr44412.ll
+++ b/llvm/test/CodeGen/X86/pr44412.ll
@@ -33,4 +33,38 @@ define void @bar(i32 %0, i32 %1) nounwind {
 8:                                                ; preds = %4, %2
   ret void
 }
+
+define void @baz(i32 %0, i32 %1) nounwind {
+; CHECK-LABEL: baz:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pushq %rbx
+; CHECK-NEXT:    testl %edi, %edi
+; CHECK-NEXT:    je .LBB1_3
+; CHECK-NEXT:  # %bb.1: # %.preheader
+; CHECK-NEXT:    movl %edi, %ebx
+; CHECK-NEXT:    decl %ebx
+; CHECK-NEXT:    .p2align 4, 0x90
+; CHECK-NEXT:  .LBB1_2: # =>This Inner Loop Header: Depth=1
+; CHECK-NEXT:    movl %ebx, %edi
+; CHECK-NEXT:    callq foo
+; CHECK-NEXT:    decl %ebx
+; CHECK-NEXT:    cmpl $-1, %ebx
+; CHECK-NEXT:    je .LBB1_2
+; CHECK-NEXT:  .LBB1_3:
+; CHECK-NEXT:    popq %rbx
+; CHECK-NEXT:    retq
+  %3 = icmp eq i32 %0, 0
+  br i1 %3, label %8, label %4
+
+4:                                                ; preds = %2, %4
+  %5 = phi i32 [ %6, %4 ], [ %0, %2 ]
+  %6 = add nsw i32 %5, -1
+  tail call void @foo(i32 %6)
+  %7 = icmp ne i32 %6, 0
+  br i1 %7, label %8, label %4
+
+8:                                                ; preds = %4, %2
+  ret void
+}
+
 declare void @foo(i32)


        


More information about the llvm-commits mailing list