GenericSpecializer: drop unused indirect arguments.

If there is no read from an indirect argument, this argument has to be dropped.
At the call site the store to the argument's memory location could have been removed (based on the callee's memory effects).
Therefore, converting such an unused indirect argument to a direct argument, would load an uninitialized value at the call site.
This would lead to verifier errors and in worst case to a miscompile because IRGen can implicitly use dead arguments, e.g. for getting the type of a class reference.
This commit is contained in:
Erik Eckstein
2024-08-26 11:19:12 +02:00
parent c8e74b8393
commit b54117c22d
15 changed files with 167 additions and 111 deletions

View File

@@ -5,7 +5,7 @@
// CHECK: sil private @top_level_code
// CHECK: sil public_external [serialized] [ossa] @$ss1XVABycfC{{.*}}
// CHECK: sil public_external [serialized] [ossa] @$ss17the_thing_it_does1xys1XV_tF{{.*}}
// CHECK: sil shared [serialized] [noinline] [ossa] @$ss9the_thing1tyx_tlFs1XV_Tgq5{{.*}}
// CHECK: sil shared [serialized] [noinline] [ossa] @$ss9the_thing1tyx_tlFs1XV_Ttgq5{{.*}}
sil_stage canonical