Commit Graph
3 Commits
Author SHA1 Message Date
upstream aa0b6871d2 Upstream icsharpcode/ILSpy state of the touched files before d5ff770959 2026-09-11 23:55:33 +02:00
dualfroz 167098573c Keep a discarded method-group conversion out of the delegate cache
CachedDelegateInitializationWithField only fired when the instruction
after the caching `if` read the cache field exactly once. A discarded
conversion -- `_ = (Action<int>)M;` -- reads it zero times: Roslyn emits
the null check and the store, and nothing else. The transform bailed out,
so the `<>O` cache class and its `<0>__M` field survived into the output
under names no C# compiler will accept.

Zero usages is now handled: the `if` is replaced by the delegate
construction it guarded, which is what the source expressed, and the
caching disappears with the field. The rest of the method is checked for
loads of the same field first, since only then is this `if` the sole
initialization.

Closes #3965
2026-09-19 11:14:31 +02:00
upstream 80cf67e749 Upstream icsharpcode/ILSpy state of the touched files before 259e513829 2026-09-11 23:42:13 +02:00