Add test for untested path in SimplifyCFG

This case wasn't checked with a pointer condition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190739 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault 2013-09-14 02:44:02 +00:00
parent 2849503ab2
commit 262dee1ebf

View File

@ -1,4 +1,7 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
; RUN: opt -S -simplifycfg < %s | FileCheck -check-prefix=CHECK %s
; RUN: opt -S -default-data-layout="p:32:32" -simplifycfg < %s | FileCheck -check-prefix=DL %s
; TODO: Other tests should also have check lines with datalayout
declare void @foo1()
@ -22,6 +25,25 @@ F: ; preds = %0
; CHECK: ]
}
define void @test1_ptr(i32* %V) {
%C1 = icmp eq i32* %V, inttoptr (i32 4 to i32*)
%C2 = icmp eq i32* %V, inttoptr (i32 17 to i32*)
%CN = or i1 %C1, %C2 ; <i1> [#uses=1]
br i1 %CN, label %T, label %F
T: ; preds = %0
call void @foo1( )
ret void
F: ; preds = %0
call void @foo2( )
ret void
; DL-LABEL: @test1_ptr(
; DL: %magicptr = ptrtoint i32* %V to i32
; DL: switch i32 %magicptr, label %F [
; DL: i32 17, label %T
; DL: i32 4, label %T
; DL: ]
}
define void @test2(i32 %V) {
%C1 = icmp ne i32 %V, 4 ; <i1> [#uses=1]
%C2 = icmp ne i32 %V, 17 ; <i1> [#uses=1]