17ea597eaSAlexandros Lamprineas; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 27ea597eaSAlexandros Lamprineas 37ea597eaSAlexandros Lamprineas; RUN: opt -passes="ipsccp<func-spec>" -force-specialization \ 47ea597eaSAlexandros Lamprineas; RUN: -funcspec-for-literal-constant -S < %s | FileCheck %s 57ea597eaSAlexandros Lamprineas 67ea597eaSAlexandros Lamprineasdefine i32 @foo(i32 %y0, i32 %y1) { 77ea597eaSAlexandros Lamprineas; CHECK-LABEL: @foo( 87ea597eaSAlexandros Lamprineas; CHECK-NEXT: entry: 97ea597eaSAlexandros Lamprineas; CHECK-NEXT: [[Y:%.*]] = insertvalue { i32, i32 } undef, i32 [[Y0:%.*]], 0 107ea597eaSAlexandros Lamprineas; CHECK-NEXT: [[YY:%.*]] = insertvalue { i32, i32 } [[Y]], i32 [[Y1:%.*]], 1 11*e15d72adSAlexandros Lamprineas; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @add.specialized.1({ i32, i32 } { i32 2, i32 3 }, { i32, i32 } [[YY]]) 127ea597eaSAlexandros Lamprineas; CHECK-NEXT: ret i32 [[CALL]] 137ea597eaSAlexandros Lamprineas; 147ea597eaSAlexandros Lamprineasentry: 157ea597eaSAlexandros Lamprineas %y = insertvalue { i32, i32 } undef, i32 %y0, 0 167ea597eaSAlexandros Lamprineas %yy = insertvalue { i32, i32 } %y, i32 %y1, 1 177ea597eaSAlexandros Lamprineas %call = tail call i32 @add({i32, i32} {i32 2, i32 3}, {i32, i32} %yy) 187ea597eaSAlexandros Lamprineas ret i32 %call 197ea597eaSAlexandros Lamprineas} 207ea597eaSAlexandros Lamprineas 217ea597eaSAlexandros Lamprineasdefine i32 @bar(i32 %x0, i32 %x1) { 227ea597eaSAlexandros Lamprineas; CHECK-LABEL: @bar( 237ea597eaSAlexandros Lamprineas; CHECK-NEXT: entry: 247ea597eaSAlexandros Lamprineas; CHECK-NEXT: [[X:%.*]] = insertvalue { i32, i32 } undef, i32 [[X0:%.*]], 0 257ea597eaSAlexandros Lamprineas; CHECK-NEXT: [[XX:%.*]] = insertvalue { i32, i32 } [[X]], i32 [[X1:%.*]], 1 26*e15d72adSAlexandros Lamprineas; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @add.specialized.2({ i32, i32 } [[XX]], { i32, i32 } { i32 3, i32 2 }) 277ea597eaSAlexandros Lamprineas; CHECK-NEXT: ret i32 [[CALL]] 287ea597eaSAlexandros Lamprineas; 297ea597eaSAlexandros Lamprineasentry: 307ea597eaSAlexandros Lamprineas %x = insertvalue { i32, i32 } undef, i32 %x0, 0 317ea597eaSAlexandros Lamprineas %xx = insertvalue { i32, i32 } %x, i32 %x1, 1 327ea597eaSAlexandros Lamprineas %call = tail call i32 @add({i32, i32} %xx, {i32, i32} {i32 3, i32 2}) 337ea597eaSAlexandros Lamprineas ret i32 %call 347ea597eaSAlexandros Lamprineas} 357ea597eaSAlexandros Lamprineas 367ea597eaSAlexandros Lamprineasdefine internal i32 @add({i32, i32} %x, {i32, i32} %y) { 377ea597eaSAlexandros Lamprineasentry: 387ea597eaSAlexandros Lamprineas %x0 = extractvalue {i32, i32} %x, 0 397ea597eaSAlexandros Lamprineas %y0 = extractvalue {i32, i32} %y, 0 407ea597eaSAlexandros Lamprineas %add0 = add nsw i32 %x0, %y0 417ea597eaSAlexandros Lamprineas %x1 = extractvalue {i32, i32} %x, 1 427ea597eaSAlexandros Lamprineas %y1 = extractvalue {i32, i32} %y, 1 437ea597eaSAlexandros Lamprineas %add1 = add nsw i32 %x1, %y1 447ea597eaSAlexandros Lamprineas %mul = mul i32 %add0, %add1 457ea597eaSAlexandros Lamprineas ret i32 %mul 467ea597eaSAlexandros Lamprineas} 47