Skip to content

Commit 1cbef7f

Browse files
authored
Refactor bisector system, add supervisor, add unit tests, and fix transformations (#1290)
* Refactor bisector system, add supervisor, add unit tests, and fix transformations. Major refactor of UnitTestBisectorSystem: introduces new bisector plans (DisableOne, EnableOne, RandomCombo, FailureInducing, Masking), robust state management, improved transform observation, and enhanced reporting. Adds Mosa.Utility.UnitTestBisector.Supervisor for process supervision and restart. Updates command-line options, documentation, and project files. Improves diagnostics, output, and testability throughout the bisector and unit test infrastructure. * Enable SafePoint stages in method compiler pipeline Activated SafePointStage before and SafePointLayoutStage after CodeGenerationStage in the method compiler pipeline, enabling GC safepoint infrastructure for improved garbage collection support. * Standardize bisect arg names, refactor bisector logic - Renames `-bisect-state-file` to `-bisect-state` for consistency. - Refactors bisector plan/order parsing to use switch expressions. - Simplifies output and reporting in bisector system. - Removes redundant/debug code from transform disabling logic. - Updates `Mosa.Linux.sln` for VS2022 and normalizes configs. - Applies minor string, argument, and formatting cleanups. * Refactor: centralize bisector constants in Constant.cs Move magic constants (exit kinds, baseline iteration, option names, etc.) to a new Constant.cs file. Update all usages in BisectorState.cs and UnitTestBisectorSystem.cs to reference the Constant class, improving maintainability and reducing duplication. * Remove forced-disabled transforms from bisector logic Eliminates all handling of forced-disabled transforms and the related file option from the bisector system. Updates state, compatibility checks, and reporting to only use session-based disabled transforms. Refactors IsSupervisorOption to use a switch expression and performs minor cleanup in unit test handling and status output. * Refactor bisector classes to internal top-level types Refactored private nested classes in Mosa.Utility.UnitTestBisector to internal top-level classes for better accessibility and maintainability. Moved PlanKind and OrderKind enums to separate files. Removed BisectorDisabledTransformsFile from MOSASettings. No functional changes. * Refactor: Move unit test serialization to new class Extract unit test serialization, result parsing, and formatting logic from UnitTestSystem into a new static UnitTestSerializer class. Update all usages in UnitTestSystem, UnitTestEngine, and UnitTestBisectorSystem to use UnitTestSerializer, improving code organization and separation of concerns. * Refactor unit test discovery and execution flow Centralize unit test discovery and execution in a new UnitTestRunner static class. Update UnitTestBisectorSystem and UnitTestSystem to use this runner, passing discovered tests explicitly. Remove shared state for test lists, clean up unused code, and improve separation of concerns for better maintainability. * Refactor Sub64 logic for clarity in BitTrackerOperations Clarified Sub64 by adding an explicit else branch. Now, when value2 is zero, the result is narrowed to value1; otherwise, SetStable(value1, value2) is used. This improves code readability and intent. * Add sign extension tests and fix SignExtend32x64 mask Added thorough unit tests for SignExtend32x64 and SignExtend8x64, covering all sign bit and known/unknown bit scenarios. Fixed SignExtend32x64 to use the correct upper 32 bits mask for sign extension. * Add new optimization defaults; reformat Constant.cs Added default settings for ReduceCodeSize and inlining options in MOSASettings. Reformatted Constant.cs to use tabs for indentation. No logic changes in constants. * Refactor bisector session state and iteration handling Refactored bisector logic to introduce explicit session state fields in BisectorState, persist session name and invert outcome, and improve masking pre-check handling. Platform registration is now centralized. Bisector plan execution is split into clear phases with robust state management, supporting single-iteration-per-process and supervisor restarts. Output and disabled transform logic are clarified and simplified. * Replay all bisector session results from index 0 Previously, the loop skipped the first result when restoring bisector state. Now, all results in state.Results are replayed to ensure the bisector state is fully restored. * Add regression tests and fix BitTrackerOperations bugs Comprehensive regression and additional unit tests were added for BitTrackerOperations. Fixed Add64 to only narrow min/max when no unsigned overflow is possible. Corrected And32 to use BitsSet32 for zero checks. Updated RemUnsigned32/64 to use value2.MaxValue for bounds and consolidated divide-by-zero guards. Fixed ShiftRight64 to track stability with both operands. * Improve BitTrackerOperations edge case handling and tests Added comprehensive unit tests for Add32, MulUnsigned32, MulSigned32, MulSigned64, and To64, covering overflow and range-narrowing scenarios. Simplified Add32 overflow checks by removing unreachable conditions. Corrected MulSigned32 and MulSigned64 to use actual min/max products for range narrowing. Fixed MulUnsigned32 to only clear upper 32 bits on overflow. Clarified RemUnsigned32 zero-divisor comment. Updated To64 to use BitsSet32 for constructing 64-bit values from 32-bit parts. * update 1 * Reorganize tests * Add AddCarryOut32/64 logic and expand boolean narrowing tests Implemented AddCarryOut32 and AddCarryOut64 in BitTrackerOperations for precise sum and carry-out tracking. Updated BitTrackerStage to use these handlers for IR.AddCarryOut32/64. Added thorough tests for Result2NarrowToBoolean, covering upper bits, unconstrained, known true/false, and stability cases. * Add unit tests and handlers for Add/Sub carry/overflow ops Added thorough unit tests for BitTrackerOperations covering AddCarryOut32/64, AddOverflowOut32/64, SubCarryOut32/64, and SubOverflowOut32/64, including edge cases. Updated BitTrackerStage to register and implement dedicated handler methods for these IR instructions, replacing the previous generic handler. * Document BitTrackerStage and related subsystems Expand copilot-instructions.md with a detailed "BitTracker Stage" section, covering architecture, BitValue lattice, IntegerTwiddling helpers, dual-result instruction handling, and extension guidelines. Update key namespaces/classes and clarify documentation requirements for new settings. * Fix signed subtraction overflow logic and tests Correct IsSubSignedOverflow for int/long to use MinValue+ and MaxValue+ logic. Expand and update related unit tests to cover edge cases and match new overflow detection. * Standardize carry/overflow out IR handling in BitTracker Replaced custom handlers for Add/Sub CarryOut and OverflowOut IR instructions with the shared Result2NarrowToBoolean method in BitTrackerStage. This unifies and simplifies result processing by consistently narrowing these results to boolean values. * Update AddOverflowOut handlers in BitTrackerStage Switched IR.AddOverflowOut32 and IR.AddOverflowOut64 to use dedicated handlers (AddOverflowOut32/AddOverflowOut64) instead of the generic Result2NarrowToBoolean, enabling more precise bit-tracking for overflow detection. * Update BitTracker handlers for SubCarry/Overflow IR ops Replaced generic Result2NarrowToBoolean handler with specific handlers for SubCarryOut32, SubCarryOut64, SubOverflowOut32, and SubOverflowOut64 in BitTrackerStage. This enables more accurate bit-tracking for these instructions. * Update bisector to support all stages by default Removed default stage restriction in bisector logic, allowing bisecting across all stages when BisectorStage is unset. Output now displays "All" for unspecified stages. Also removed unused upper bit mask constants from BitTrackerStage.cs. * Update BitTrackerStage to use generic handler for SubCarryOut Replaced SubCarryOut32 and SubCarryOut64 handlers with the generic Result2NarrowToBoolean handler in BitTrackerStage, simplifying the registration and handling logic for these IR instructions. * Tighten BitValue equality; simplify bisector counters - IsSame in BitValue now checks Is32Bit for stricter equality. - RecalculateCounters in UnitTestBisectorSystem always sums Results and Baseline, removing special case logic. - Reformatted UnitTestRunner.cs to use tabs per project style. * Track newly observed transforms per iteration Add NewlyObservedTransforms to PlanResult and update bisector logic to record, replay, and persist transforms first seen in each iteration. Simplify and standardize iteration status output, comment out redundant logs, and improve status formatting for clarity. * Refactor bisector header output to single line Consolidate multiple OutputStatusBisector calls in PrintIterationHeader into a single formatted line, improving log readability and reducing output verbosity. * Clean up bisector: remove dead code and debug prints Refactored UnitTestBisectorSystem.cs and Builder.cs by removing commented-out and redundant debug print statements, including PrintDisabledTransforms. Moved OutputStatusBisector and OutputStatus methods for clarity. The "Order" field is now always displayed, and RecalculateCounters logic is simplified. No changes to core functionality. * Refactor bisector output methods and add FailureCount Replaces all "Print" status methods with unified "Output" methods for consistency. Adds FailureCount to BisectorState and updates all failure tracking logic to use it. Enhances OutputIterationStatus to show cumulative stats. Updates all bisector workflows to use new output methods and ensures accurate failure reporting. * Refactor: organize bisector logic into regions & helpers Refactored UnitTestBisectorSystem to group related methods into logical regions (Entry Point, Plan Execution, Iteration Execution, State Management, Plan & Transform Helpers, File I/O, Output). Extracted and restructured helper methods for state management, plan parsing, output, and transform set building. Separated deterministic and random plan execution logic. Improved code clarity and maintainability without changing functional behavior. * Track and report unit test restarts-exceeded failures Add hasRestartsExceeded to detect when unit test system restarts are exceeded. Update all plan execution paths to halt and record failure if this occurs. Enhance failure review file to indicate both compilation failures and restarts-exceeded conditions for improved diagnostics. * Move BitTrackerOperations to Analysis namespace Relocated BitTrackerOperations from Mosa.Compiler.Framework.Stages to Mosa.Compiler.Framework.Analysis without changing its logic. Updated all references and using directives in affected files to use the new namespace. * Enhance transform hooks and conditional diagnostics Add notifications and disable checks for block transforms via CompilerHooks in BaseTransformStage. Make application launch status output conditional on MosaSettings.Diagnostic in BaseLauncher. * Enable transform hooks selectively in OptimizationStage Allow OptimizationStage to opt-in to transform hook notifications and filtering by introducing an EnableTransformHooks property. Only stages with this property enabled will invoke transform hook logic, reducing unnecessary calls. Also, override the Name property in platform-specific OptimizationStages to include the platform prefix. * Add global.json to specify .NET SDK version 10.0.203 Added global.json to enforce usage of .NET SDK 10.0.203 with rollForward set to "latestFeature", ensuring consistent build environments across development and CI. * Improve PipelinePool lifecycle management in Compiler Added a private pipelinePool field to the Compiler class to track the PipelinePool instance during parallel compilation. Updated ExecuteCompile to assign and clear pipelinePool appropriately. Modified Stop to notify the PipelinePool when stopping the compiler. Also removed the global.json file specifying the .NET SDK version. * Code cleanup: formatting, unused usings, add NotifyStop Improved code formatting and indentation across several files for readability. Removed unused using directives in BitTrackerStage.cs and RemoveUnreachableBlocks.cs. Added NotifyStop method to PipelinePool.cs to signal dispatcher shutdown. No functional changes except for the new NotifyStop method. * Adjust method pipeline, docs, and UI usability - Clarified default for `-bisect-stage` in command-line docs. - Refactored method compiler pipeline: always add `DeadBlockStage` with SSA, moved `SafePointStage` after `JumpOptimizationStage`, and removed `PlatformEdgeSplitStage`. - Added `EmitBinary` property to `ProtectedRegionLayoutStage` and updated logic to respect it. - Removed obsolete comment in `CodeGenerationStage.cs`. - Improved UI usability: enabled `CheckOnClick` for relevant checkboxes and cleared default text in `tbTransformStage`. * Enhance reduction logic and add optimization args - Improve `ProcessReductionResult` in `Bisector.cs` to include items activated after experiment start in reduction candidates. - Add `Optimizations_Inline_Maximum`, `Optimizations_ScanWindow`, and `Optimizations_ReduceCodeSize` arguments to `-oSize` and `-oFast` profiles in `CommandLineArguments.cs`. - Reformat `UnitTestSerializer.cs` for style consistency; logic unchanged. * Remove dynamic bisecting, fuzz tests, and refactor transforms Removed all dynamic item observation logic from the Bisector, including ObserveItem and related suspect/candidate set management. Refactored transform tracking to use a single registered Transforms list, eliminating observed transform counts and simplifying state management. Updated all bisector logic, reporting, and compiler hooks to use the new RegisterTransform callback. Deleted all Fuzz0001–Fuzz0018 test files and their contents, removing hundreds of static fuzz test methods. Cleaned up output formatting, removed obsolete code, and improved error handling in the process supervisor. * Rename EnableTransformHooks to AllowTransformHooks Renamed the EnableTransformHooks property to AllowTransformHooks in BaseTransformStage and all derived OptimizationStage classes (ARM32, ARM64, x86, x64, and generic). Updated all references accordingly for naming consistency. No functional changes were made.
1 parent 8e6aa94 commit 1cbef7f

94 files changed

Lines changed: 8319 additions & 148475 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/copilot-instructions.md‎

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ Key namespaces/classes:
201201
- `Mosa.Compiler.Framework.Context` – represents a position in the instruction stream
202202
- `Mosa.Compiler.MosaTypeSystem` – MOSA's type system (wraps `dnlib`)
203203
- `Mosa.Compiler.Framework.IR` – IR instruction definitions
204+
- `Mosa.Compiler.Framework.Stages.BitTrackerStage` – per-method stage that propagates value range and known-bit information; see **BitTracker Stage** section below
205+
- `Mosa.Compiler.Framework.Stages.BitTrackerOperations` – stateless, node-free operation logic for BitTrackerStage; unit-tested in `Mosa.Compiler.Framework.xUnit/BitTrackerOperationsTests.cs`
206+
- `Mosa.Compiler.Framework.BitValue` – the value/bit-range lattice type used throughout the BitTracker subsystem
207+
- `Mosa.Compiler.Common.IntegerTwiddling` – carry/overflow predicate helpers used by BitTrackerOperations
204208

205209
Optimization levels (set via `-oN`):
206210
- `-o0` = no optimizations
@@ -229,6 +233,151 @@ When adding new files to existing projects:
229233
5. If adding a new compiler transform, inherit from `BaseTransform` and register it in the appropriate stage.
230234
6. If adding new unit tests (xUnit), add them to `Mosa.Compiler.Common.xUnit` or `Mosa.Compiler.Framework.xUnit`.
231235
7. If adding new bare-metal test cases, add them to `Mosa.UnitTests` following the existing pattern with `[MosaUnitTest]` attributes.
236+
8. If adding a new setting to `MosaSettings` or `CommandLineArguments`, also add the corresponding entry to `Docs/command-line-arguments.rst`.
237+
238+
---
239+
240+
## BitTracker Stage
241+
242+
`BitTrackerStage` (`Mosa.Compiler.Framework/Stages/BitTrackerStage.cs`) is a per-method optimization stage that propagates **value range and known-bit information** through the instruction stream. This extra knowledge enables downstream constant folding, branch elimination, and instruction simplification.
243+
244+
### Architecture
245+
246+
The stage is split across two files:
247+
248+
| File | Role |
249+
|---|---|
250+
| `BitTrackerStage.cs` | Stage driver: iterates virtual registers, calls per-instruction visitors, folds constants, eliminates dead branches |
251+
| `BitTrackerOperations.cs` | Pure static operation logic: takes `BitValue` operands directly — no `Node` dependency — making it fully unit-testable in isolation |
252+
253+
The stage runs iteratively (up to 10 passes) until all virtual registers are `IsStable`, to handle SSA phi-nodes and other circular dependencies.
254+
255+
### `BitValue` — the information lattice
256+
257+
`BitValue` (`Mosa.Compiler.Framework/BitValue.cs`) tracks what is known about a virtual register's value at compile time. All mutations are monotone — they can only **narrow** the range, never widen it.
258+
259+
Key properties:
260+
261+
| Property | Type | Meaning |
262+
|---|---|---|
263+
| `BitsSet` / `BitsSet32` | `ulong` / `uint` | Bits that are definitely 1 |
264+
| `BitsClear` / `BitsClear32` | `ulong` / `uint` | Bits that are definitely 0 |
265+
| `BitsKnown` | `ulong` | `BitsSet \| BitsClear` — union of all known bits |
266+
| `MinValue` / `MaxValue` | `ulong` | Inclusive unsigned value range |
267+
| `Is32Bit` / `Is64Bit` | `bool` | Whether this is a 32-bit or 64-bit register |
268+
| `IsResolved` | `bool` | True when `MinValue == MaxValue` or all bits are known |
269+
| `IsStable` | `bool` | True when no further narrowing is expected |
270+
| `AreLower32BitsKnown` | `bool` | All 32 low bits known |
271+
| `AreAll64BitsKnown` | `bool` | All 64 bits known |
272+
| `IsZero` / `IsOne` / `IsZeroOrOne` | `bool` | Convenience predicates |
273+
274+
Key mutation methods (all return `this` for fluent chaining):
275+
276+
```csharp
277+
result.SetValue(ulong value) // Set exact known constant
278+
result.SetValue(bool value) // Set 0 or 1
279+
result.NarrowMin(ulong min) // Raise the lower bound
280+
result.NarrowMax(ulong max) // Lower the upper bound
281+
result.NarrowSetBits(ulong bits) // Intersect known-set bits
282+
result.NarrowClearBits(ulong bits) // Intersect known-clear bits
283+
result.NarrowToBoolean() // Constrain to {0, 1}: MaxValue=1, BitsClear=~1ul
284+
result.Narrow(BitValue other) // Apply all narrowing from another BitValue
285+
result.SetStable() // Mark as stable (unconditionally)
286+
result.SetStable(BitValue a) // Mark stable only if `a` is stable
287+
result.SetStable(BitValue a, b) // Mark stable only if both are stable
288+
result.SetStable(BitValue a, b, c) // Mark stable only if all three are stable
289+
```
290+
291+
Constructors:
292+
```csharp
293+
new BitValue(bool is32Bit) // Unresolved, unstable
294+
new BitValue(bool is32Bit, ulong value) // Fully known constant, stable
295+
```
296+
297+
### `IntegerTwiddling` — overflow/carry predicates
298+
299+
`IntegerTwiddling` (`Mosa.Compiler.Common/IntegerTwiddling.cs`) provides all carry/overflow detection used by `BitTrackerOperations`.
300+
301+
| Method | Semantics |
302+
|---|---|
303+
| `IsAddUnsignedCarry(uint a, uint b)` | `a + b` overflows 32-bit unsigned |
304+
| `IsAddUnsignedCarry(ulong a, ulong b)` | `a + b` overflows 64-bit unsigned |
305+
| `IsAddUnsignedCarry(uint a, uint b, bool carry)` | `a + b + carry` overflows 32-bit unsigned |
306+
| `IsAddSignedOverflow(int a, int b)` | `a + b` overflows 32-bit signed |
307+
| `IsAddSignedOverflow(long a, long b)` | `a + b` overflows 64-bit signed |
308+
| `IsSubUnsignedCarry(uint a, uint b)` | `b > a` (borrow: unsigned subtraction underflows) |
309+
| `IsSubUnsignedCarry(ulong a, ulong b)` | `b > a` (borrow: 64-bit) |
310+
| `IsSubSignedOverflow(int a, int b)` | **`a + b` signed overflow** — note: despite the name, this checks signed overflow for the equivalent addition `a + b`, consistent with how x86/x64 OF is computed for SUB. Use it for `SubOverflowOut` instructions. |
311+
| `IsSubSignedOverflow(long a, long b)` | Same, 64-bit |
312+
313+
> **Important gotcha**: `IsSubSignedOverflow(a, b)` does **not** test whether `a - b` overflows in the intuitive sense. It tests whether `a + b` overflows signed, which matches the hardware overflow flag for subtraction. So `IsSubSignedOverflow(int.MinValue, -1)` returns `true` (int.MinValue + (-1) underflows), while `IsSubSignedOverflow(int.MaxValue, -1)` returns `false`.
314+
315+
### Dual-result instructions
316+
317+
Instructions with two result operands (`result` = value, `result2` = flag) use a dedicated `BitTrackerOperations` method with signature:
318+
319+
```csharp
320+
public static void XxxOut32(BitValue result, BitValue result2, BitValue value1, BitValue value2)
321+
```
322+
323+
The handler in `BitTrackerStage` passes both result `BitValue`s:
324+
325+
```csharp
326+
private static void AddCarryOut32(Node node)
327+
{
328+
BitTrackerOperations.AddCarryOut32(node.Result.BitValue, node.Result2.BitValue,
329+
node.Operand1.BitValue, node.Operand2.BitValue);
330+
}
331+
```
332+
333+
The flag (`result2`) is modelled at three levels of precision:
334+
1. **Both operands fully known** → compute exact flag value with `result2.SetValue(bool)`
335+
2. **Range analysis proves flag impossible** → `result2.SetValue(0)`
336+
3. **Range analysis proves flag certain** → `result2.SetValue(1)`
337+
4. **Uncertain** → `result2.NarrowToBoolean().SetStable(value1, value2)`
338+
339+
Currently registered dual-result instructions and their flag semantics:
340+
341+
| Instruction | `result2` flag | Detection method |
342+
|---|---|---|
343+
| `AddCarryOut32/64` | Unsigned carry from addition | `IsAddUnsignedCarry` |
344+
| `AddOverflowOut32/64` | Signed overflow from addition | `IsAddSignedOverflow` |
345+
| `SubCarryOut32/64` | Unsigned borrow from subtraction (`op2 > op1`) | `IsSubUnsignedCarry` |
346+
| `SubOverflowOut32/64` | Signed overflow (via `IsSubSignedOverflow`, which checks `a+b` signed overflow) | `IsSubSignedOverflow` |
347+
348+
### Adding a new `BitTrackerOperations` entry
349+
350+
1. Add a `public static void` method to `BitTrackerOperations.cs`. Single-result instructions receive `(BitValue result, BitValue value1, ...)`. Dual-result instructions receive `(BitValue result, BitValue result2, BitValue value1, ...)`.
351+
2. Add a private static dispatch method in `BitTrackerStage.cs` that unpacks the `Node` and calls the operation.
352+
3. Register the dispatch method in `BitTrackerStage.Initialize()` with `Register(IR.InstructionName, MethodName)`.
353+
4. Add a corresponding xUnit test class to `Mosa.Compiler.Framework.xUnit/BitTrackerOperationsTests.cs`. Each class is named `BitTracker_<InstructionName>Tests`. Cover: both operands fully known (no-flag case and flag case), zero/identity operands, range provably no-flag, range always-flag, uncertain range, min/max narrowing.
354+
355+
### Standard operation pattern
356+
357+
```csharp
358+
public static void Add32(BitValue result, BitValue value1, BitValue value2)
359+
{
360+
if (value1.AreLower32BitsKnown && value2.AreLower32BitsKnown)
361+
{
362+
result.SetValue(value1.BitsSet32 + value2.BitsSet32); // exact constant
363+
}
364+
else if (value1.AreLower32BitsKnown && value1.BitsSet32 == 0)
365+
{
366+
result.Narrow(value2).SetStable(value2); // identity: 0 + x = x
367+
}
368+
else if (!IntegerTwiddling.IsAddUnsignedCarry((uint)value1.MaxValue, (uint)value2.MaxValue))
369+
{
370+
result // range: no overflow possible
371+
.NarrowMin(value1.MinValue + value2.MinValue)
372+
.NarrowMax(value1.MaxValue + value2.MaxValue)
373+
.SetStable(value1, value2);
374+
}
375+
else
376+
{
377+
result.SetStable(value1, value2); // unknown, just mark stable
378+
}
379+
}
380+
```
232381

233382
---
234383

‎.gitignore‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
[b]in - Copy/
1515
[b]in - Copy (2)/
1616
[b]in2/
17+
/[Tt]emp
18+
/[Tt]mp
1719

1820
*.[Oo]bj
1921
*.suo
@@ -52,8 +54,6 @@ MigrationBackup/
5254
/Source/*/Properties/launchSettings.json
5355
stderr.txt
5456
stdout.txt
55-
5657
/docs/CNAME
58+
false
5759

58-
# Launcher output
59-
false

‎Source/.github/copilot-instructions.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ When adding new files to existing projects:
229229
5. If adding a new compiler transform, inherit from `BaseTransform` and register it in the appropriate stage.
230230
6. If adding new unit tests (xUnit), add them to `Mosa.Compiler.Common.xUnit` or `Mosa.Compiler.Framework.xUnit`.
231231
7. If adding new bare-metal test cases, add them to `Mosa.UnitTests` following the existing pattern with `[MosaUnitTest]` attributes.
232+
8. If adding a new setting to `MosaSettings` or `CommandLineArguments`, also add the corresponding entry to `Docs/command-line-arguments.rst`.
232233

233234
---
234235

‎Source/Data/IR-Optimizations-ConstantFolding.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@
331331
"Type": "ConstantFolding",
332332
"Name": "ConvertU32ToR#",
333333
"SubName": "",
334-
"Expression": "IR.ConvertI32ToR# a",
334+
"Expression": "IR.ConvertU32ToR# a",
335335
"Filter": "IsResolvedConstant(a)",
336336
"Result": "(IR.MoveR# [ToR#(To32(a))])",
337337
"Priority": "100"

‎Source/Data/IR-Optimizations-StrengthReduction-Complex.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"SubName": "RemUnsigned",
4040
"Expression": "IR.Compare32x## {==} (IR.RemUnsigned## a 2) 0",
4141
"Filter": "",
42-
"Result": "(IR.And## a [To##(1)])",
42+
"Result": "(IR.And## (IR.Not## a) [To##(1)])",
4343
"Variations": "Yes"
4444
},
4545
{
@@ -48,7 +48,7 @@
4848
"SubName": "RemUnsigned",
4949
"Expression": "IR.Compare64x## {==} (IR.RemUnsigned## a 2) 0",
5050
"Filter": "",
51-
"Result": "(IR.And## a [To##(1)])",
51+
"Result": "(IR.And## (IR.Not## a) [To##(1)])",
5252
"Variations": "Yes"
5353
},
5454
{

0 commit comments

Comments
 (0)