34 Commits
Author SHA1 Message Date
Daniel Grunwald b9ce8490f5 Remove hack that prevented inlining of the first instruction in each block.
Now that ILReader already creates the basic blocks and BlockBuilder only arranges them in containers, this code is no longer necessary.
2023-06-01 14:13:01 +02:00
ElektroKill 8a1e8e3c6b Make return duplication in ControlFlowSimplification less aggressive 2023-04-22 14:51:38 +02:00
Daniel Grunwald 787621fb51 Revert "Use Nop instead of InvalidExpression to hold the "goto from catch-block to try-block" comment"
This reverts commit 77dcbbee86.
2021-12-01 01:00:00 +01:00
Daniel Grunwald 77dcbbee86 Use Nop instead of InvalidExpression to hold the "goto from catch-block to try-block" comment 2021-11-30 20:55:21 +01:00
dotnet format 0d9f871a4f #2128: Reformat the whole code base. 2020-08-28 01:05:38 +02:00
Daniel Grunwald 30da0b7525 Add some missing checks to MatchRoslynSwitchOnString 2020-06-23 23:25:11 +02:00
Daniel Grunwald 9659be0d55 #1946: Fix IsBranchToReturnBlock() [was broken in c1265ad830] 2020-04-20 21:24:08 +02:00
Daniel Grunwald c1265ad830 Fix #1946: Don't move return into try block when doing so changes the semantics of a finally block. 2020-04-20 20:12:45 +02:00
Siegfried Pammer e4fda5c2e4 Rename HasILRange to ILRangeIsEmpty to properly reflect its implementation. 2020-02-26 10:31:27 +01:00
Daniel Grunwald de33e79384 Add tests for 'async IAsyncEnumerable'.
Remove [AsyncIteratorStateMachine] attribute and left-over ldc.i4 instructions.
2019-09-30 23:15:30 +02:00
Siegfried Pammer 047f119e99 Add RemoveDeadStores option 2019-08-18 00:29:37 +02:00
Daniel Grunwald b7f0e2e929 Be less aggressive when removing dead code -- some of it may still be interesting to users. 2019-07-27 22:45:34 +02:00
Daniel Grunwald 752f0de978 Further adjustments to transforms now that copy propagation no longer runs. 2019-07-27 22:17:15 +02:00
Daniel Grunwald 8117dfff4a Fix #1242: Discard unreachable code.
Unreachable code is not part of the dominator tree, which most of our transforms are based on.

In particular, dominance-based loop detection runs into the problem where unreachable code might have jumps into two independent loops. In that case, it's impossible to place the unreachable code in a way that avoids assertions / generating invalid C#.

We establish the invariant that all blocks in a BlockContainer must be statically reachable from the entry point (-> every block is part of the dominator tree). This means transforms no longer have to deal with special cases for unreachable code.

The "Remove dead and side effect free code" option still has an effect on dead stores, but unreachable code is now always removed (previously this also was dependent on this option).
2019-07-26 17:14:12 +02:00
Siegfried Pammer c1fca21e8a Make ILRange field private - introduce public API for IL range manipulation. 2019-02-16 20:36:17 +01:00
Chicken-Bones e9b766d708 Improve persistence of IL offsets through various transforms. 2018-10-08 21:21:55 +10:00
Daniel Grunwald eb6119eb7d Only use mcs for the first compilation pass. Consistently run test cases using .NET 4.x runtime. 2018-02-27 00:10:25 +01:00
Siegfried Pammer 4ca4d97011 Improve SequencePointBuilder 2017-10-14 22:47:59 +02:00
Siegfried Pammer e33a010cc7 Remove compiler-generated variable in while (true) loops. 2017-10-12 23:17:37 +02:00
Siegfried Pammer 206cdecf30 Merge Return instruction into Leave. 2017-09-16 19:24:33 +02:00
Daniel Grunwald fac340965f return statements are no longer forcibly moved into loops when the loops are within exception handling blocks. 2017-09-08 21:33:08 +02:00
Daniel Grunwald bcdd34a9d0 More aggressively duplicate return blocks in MoveNext() methods.
This fixes 'yield return' decompilation of debug builds using legacy csc.
2017-08-29 23:58:59 +02:00
Daniel Grunwald 3e8ab77d52 Perform even less aggressive inlining of return blocks. 2017-08-27 23:41:28 +02:00
Daniel Grunwald c239204c7f Perform less aggressive inlining of return blocks. This tends to reconstruct control flow closer to the original code. 2017-08-27 23:01:55 +02:00
Daniel Grunwald 2207ab40f7 Check the CancellationToken a bit more frequently. 2017-08-22 22:24:16 +02:00
Daniel Grunwald 5621101436 Reconstruct try-finally blocks in yield return decompiler 2016-12-28 19:27:56 +01:00
Siegfried Pammer 840ec04fde Namespace adjustments for Syntax classes 2016-11-26 12:06:58 +01:00
Daniel Grunwald dd485b971d Eliminate goto in conditional return in try block. 2016-11-24 16:57:36 +01:00
Daniel Grunwald 4a13491ff9 Improve switch simplifcation: combine case section with default block where possible 2016-11-21 16:32:26 +01:00
Daniel Grunwald 449bbe2043 Move transforms to transforms namespace 2016-07-10 13:58:40 +02:00
Daniel Grunwald 7e50076671 Introduce array.to.pointer instruction.
This is necessary to construct pinned regions in all cases.
2016-06-29 23:41:36 +02:00
Daniel Grunwald 2730133f5f Combine switch sections that branch to same label. 2016-06-25 16:01:11 +02:00
Siegfried Pammer f781c0335a replace IsSingleUse with IsSingleDefinition 2016-06-12 09:00:26 +09:00
Daniel Grunwald 2509f27223 * Rename ControlFlowSimplification to ConditionDetection
* Rename OptimizingTransform to ControlFlowSimplification
* Move control flow transforms to separate namespace.
2015-06-14 20:53:22 +02:00