brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 4795b42 Raw
67 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; In PR41658, argpromotion put an inalloca in a position that per the3; calling convention is passed in a register. This test verifies that4; we don't do that anymore. It also verifies that the combination of5; globalopt and argpromotion is able to optimize the call safely.6;7; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT8; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC9 10target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"11target triple = "i386-pc-windows-msvc19.11.0"12 13%struct.a = type { i8 }14 15define internal x86_thiscallcc void @internalfun(ptr %this, ptr inalloca(<{ %struct.a }>)) {16; CHECK-LABEL: define {{[^@]+}}@internalfun17; CHECK-SAME: (ptr noalias nofree readnone captures(none) [[THIS:%.*]], ptr noundef nonnull inalloca(<{ [[STRUCT_A:%.*]] }>) align 4 dereferenceable(1) [[TMP0:%.*]]) {18; CHECK-NEXT:  entry:19; CHECK-NEXT:    [[ARGMEM:%.*]] = alloca inalloca <{ [[STRUCT_A]] }>, align 420; CHECK-NEXT:    [[CALL:%.*]] = call x86_thiscallcc ptr @copy_ctor(ptr noundef nonnull align 4 dereferenceable(1) [[ARGMEM]], ptr noundef nonnull align 4 dereferenceable(1) [[TMP0]])21; CHECK-NEXT:    call void @ext(ptr noundef nonnull inalloca(<{ [[STRUCT_A]] }>) align 4 dereferenceable(1) [[ARGMEM]])22; CHECK-NEXT:    ret void23;24entry:25  %argmem = alloca inalloca <{ %struct.a }>, align 426  %call = call x86_thiscallcc ptr @copy_ctor(ptr %argmem, ptr dereferenceable(1) %0)27  call void @ext(ptr inalloca(<{ %struct.a }>) %argmem)28  ret void29}30 31; This is here to ensure @internalfun is live.32define void @exportedfun(ptr %a) {33; TUNIT-LABEL: define {{[^@]+}}@exportedfun34; TUNIT-SAME: (ptr nofree readnone captures(none) [[A:%.*]]) {35; TUNIT-NEXT:    [[INALLOCA_SAVE:%.*]] = tail call ptr @llvm.stacksave.p0() #[[ATTR1:[0-9]+]]36; TUNIT-NEXT:    [[ARGMEM:%.*]] = alloca inalloca <{ [[STRUCT_A:%.*]] }>, align 437; TUNIT-NEXT:    call x86_thiscallcc void @internalfun(ptr noalias nofree readnone captures(none) undef, ptr noundef nonnull inalloca(<{ [[STRUCT_A]] }>) align 4 dereferenceable(1) [[ARGMEM]])38; TUNIT-NEXT:    call void @llvm.stackrestore.p0(ptr nofree [[INALLOCA_SAVE]])39; TUNIT-NEXT:    ret void40;41; CGSCC-LABEL: define {{[^@]+}}@exportedfun42; CGSCC-SAME: (ptr nofree readnone captures(none) [[A:%.*]]) {43; CGSCC-NEXT:    [[INALLOCA_SAVE:%.*]] = tail call ptr @llvm.stacksave.p0() #[[ATTR1:[0-9]+]]44; CGSCC-NEXT:    [[ARGMEM:%.*]] = alloca inalloca <{ [[STRUCT_A:%.*]] }>, align 445; CGSCC-NEXT:    call x86_thiscallcc void @internalfun(ptr noalias nofree readnone captures(none) [[A]], ptr noundef nonnull inalloca(<{ [[STRUCT_A]] }>) align 4 dereferenceable(1) [[ARGMEM]])46; CGSCC-NEXT:    call void @llvm.stackrestore.p0(ptr nofree [[INALLOCA_SAVE]])47; CGSCC-NEXT:    ret void48;49  %inalloca.save = tail call ptr @llvm.stacksave()50  %argmem = alloca inalloca <{ %struct.a }>, align 451  call x86_thiscallcc void @internalfun(ptr %a, ptr inalloca(<{ %struct.a }>) %argmem)52  call void @llvm.stackrestore(ptr %inalloca.save)53  ret void54}55 56declare x86_thiscallcc ptr @copy_ctor(ptr returned, ptr dereferenceable(1))57declare void @ext(ptr inalloca(<{ %struct.a }>))58declare ptr @llvm.stacksave()59declare void @llvm.stackrestore(ptr)60;.61; TUNIT: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn }62; TUNIT: attributes #[[ATTR1]] = { nofree willreturn }63;.64; CGSCC: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn }65; CGSCC: attributes #[[ATTR1]] = { nofree willreturn }66;.67