Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc19.0.24215"

define i32 @dipsy(i32, i32) local_unnamed_addr #0 {
; CHECK: Function Attrs: naked
; CHECK-LABEL: define {{[^@]+}}@dipsy
; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
; CHECK-NEXT:  BasicBlock0:
; CHECK-NEXT:    call void asm "\0D\0Apushl %ebp\0D\0Amovl 8([[ESP:%.*]]),%eax\0D\0Amovl 12([[ESP]]), %ebp\0D\0Acalll *%eax\0D\0Apopl %ebp\0D\0Aretl\0D\0A", ""()
; CHECK-NEXT:    ret i32 0
;
BasicBlock0:
  call void asm "\0D\0Apushl %ebp\0D\0Amovl 8(%esp),%eax\0D\0Amovl 12(%esp), %ebp\0D\0Acalll *%eax\0D\0Apopl %ebp\0D\0Aretl\0D\0A", ""()
  ret i32 0
}

define void @tinkywinky(i32, i32, i32) local_unnamed_addr #0 {
; CHECK: Function Attrs: naked
; CHECK-LABEL: define {{[^@]+}}@tinkywinky
; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0]] {
; CHECK-NEXT:  BasicBlock1:
; CHECK-NEXT:    call void asm "\0D\0A movl 12([[ESP:%.*]]), %ebp\0D\0A movl 4([[ESP]]), %eax\0D\0A movl 8([[ESP]]), %esp\0D\0A jmpl *%eax\0D\0A", ""()
; CHECK-NEXT:    ret void
;
BasicBlock1:
  call void asm "\0D\0A    movl 12(%esp), %ebp\0D\0A    movl 4(%esp), %eax\0D\0A    movl 8(%esp), %esp\0D\0A    jmpl *%eax\0D\0A", ""()
  ret void
}

define void @patatino(i32, i32, i32) local_unnamed_addr #1 {
; CHECK-LABEL: define {{[^@]+}}@patatino
; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
; CHECK-NEXT:  bb:
; CHECK-NEXT:    [[TMP3:%.*]] = tail call i32 @dipsy(i32 [[TMP0]], i32 [[TMP1]]) #[[ATTR0]]
; CHECK-NEXT:    tail call void @tinkywinky(i32 [[TMP3]], i32 [[TMP2]], i32 [[TMP1]]) #[[ATTR0]]
; CHECK-NEXT:    ret void
;
bb:
  %3 = tail call i32 @dipsy(i32 %0, i32 %1) #0
; Check that we don't accidentally propagate zero.
  tail call void @tinkywinky(i32 %3, i32 %2, i32 %1) #0
  ret void
}

attributes #0 = { naked }
attributes #1 = { "frame-pointer"="all" }
;.
; CHECK: attributes #[[ATTR0]] = { naked }
; CHECK: attributes #[[ATTR1]] = { "frame-pointer"="all" }
;.