Trevor Gross f62ae7e120
Rollup merge of #128271 - Nilstrieb:jump-into-a-can-of-worms-called-float-equality, r=compiler-errors
Disable jump threading of float equality

Jump threading stores values as `u128` (`ScalarInt`) and does its comparisons for equality as integer comparisons.
This works great for integers. Sadly, not everything is an integer.

Floats famously have wonky equality semantcs, with `NaN!=NaN` and `0.0 == -0.0`. This does not match our beautiful integer bitpattern equality and therefore causes things to go horribly wrong.

While jump threading could be extended to support floats by remembering that they're floats in the value state and handling them properly, it's signficantly easier to just disable it for now.

fixes #128243
2024-07-27 13:33:00 -04:00
..
2024-06-03 14:17:16 +10:00
2024-07-01 05:17:13 -07:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-04-20 19:10:23 +00:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-02-13 17:21:53 +00:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-16 18:23:48 +02:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-01-28 13:50:20 -06:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00
2024-06-03 14:17:16 +10:00

This folder contains tests for MIR optimizations.

The mir-opt test format emits MIR to extra files that you can automatically update by specifying --bless on the command line (just like ui tests updating .stderr files).

--blessable test format

By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the presence of pointers in constants or other bit width dependent things. In that case you can add

// EMIT_MIR_FOR_EACH_BIT_WIDTH

to your test, causing separate files to be generated for 32bit and 64bit systems.

Testing a particular MIR pass

If you are only testing the behavior of a particular mir-opt pass on some specific input (as is usually the case), you should add

//@ test-mir-pass: PassName

to the top of the file. This makes sure that other passes don't run which means you'll get the input you expected and your test won't break when other code changes. This also lets you test passes that are disabled by default.

Emit a diff of the mir for a specific optimization

This is what you want most often when you want to see how an optimization changes the MIR.

// EMIT_MIR $file_name_of_some_mir_dump.diff

Emit mir after a specific optimization

Use this if you are just interested in the final state after an optimization.

// EMIT_MIR $file_name_of_some_mir_dump.after.mir

Emit mir before a specific optimization

This exists mainly for completeness and is rarely useful.

// EMIT_MIR $file_name_of_some_mir_dump.before.mir

FileCheck directives

The LLVM FileCheck tool is used to verify the contents of output MIR against CHECK directives present in the test file. This works on the runtime MIR, generated by --emit=mir, and not on the output of a individual passes.

Use // skip-filecheck to prevent FileCheck from running.

To check MIR for function foo, start with a // CHECK-LABEL fn foo( directive.

{{regex}} syntax allows to match regex.

[[name:regex]] syntax allows to bind name to a string matching regex, and refer to it as [[name]] in later directives, regex should be written not to match a leading space. Use [[my_local:_.*]] to name a local, and [[my_bb:bb.*]] to name a block.

Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html