40 lines · plain
1; Test that the printf library call simplifier works correctly.2;3; RUN: opt < %s -passes=instcombine -S | FileCheck %s4 5target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-pc-windows-msvc18.0.0"7 8@.str = private unnamed_addr constant [2 x i8] c"\0A\00", align 19 10define void @test1() personality ptr @__CxxFrameHandler3 {11entry:12 invoke void @_CxxThrowException(ptr null, ptr null)13 to label %unreachable unwind label %catch.dispatch14 15catch.dispatch:16 %cs = catchswitch within none [label %catch] unwind to caller17 18catch:19 %cp = catchpad within %cs [ptr null, i32 64, ptr null]20 %call = call i32 (ptr, ...) @printf(ptr @.str) [ "funclet"(token %cp) ]21 catchret from %cp to label %try.cont22 23try.cont:24 ret void25 26unreachable:27 unreachable28}29 30; CHECK-DAG: define void @test1(31; CHECK: %[[CS:.*]] = catchswitch within none32; CHECK: %[[CP:.*]] = catchpad within %[[CS]] [ptr null, i32 64, ptr null]33; CHECK: call i32 @putchar(i32 10) [ "funclet"(token %[[CP]]) ]34 35declare void @_CxxThrowException(ptr, ptr)36 37declare i32 @__CxxFrameHandler3(...)38 39declare i32 @printf(ptr, ...)40