Add/edit tests to include instruction-level FMF on calls
[oota-llvm.git] / test / Transforms / InstCombine / printf-3.ll
1 ; Test that the printf library call simplifier works correctly.
2 ;
3 ; RUN: opt < %s -instcombine -S | FileCheck %s
4
5 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-pc-windows-msvc18.0.0"
7
8 @.str = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
9
10 define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
11 entry:
12   invoke void @_CxxThrowException(i8* null, i8* null)
13           to label %unreachable unwind label %catch.dispatch
14
15 catch.dispatch:
16   %cs = catchswitch within none [label %catch] unwind to caller
17
18 catch:
19   %cp = catchpad within %cs [i8* null, i32 64, i8* null]
20   %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0)) [ "funclet"(token %cp) ]
21   catchret from %cp to label %try.cont
22
23 try.cont:
24   ret void
25
26 unreachable:
27   unreachable
28 }
29
30 ; CHECK-DAG: define void @test1(
31 ; CHECK: %[[CS:.*]] = catchswitch within none
32 ; CHECK: %[[CP:.*]] = catchpad within %[[CS]] [i8* null, i32 64, i8* null]
33 ; CHECK: call i32 @putchar(i32 10) [ "funclet"(token %[[CP]]) ]
34
35 declare void @_CxxThrowException(i8*, i8*)
36
37 declare i32 @__CxxFrameHandler3(...)
38
39 declare i32 @printf(i8*, ...)