Just implemented the patch you suggested along with the test case.
Details
Diff Detail
Event Timeline
test/Transforms/Reassociate/undef.ll | ||
---|---|---|
4 ↗ | (On Diff #18216) | Please use FileCheck for the expected output rather than just assuming a lack of crash is correct. Nit: "The Reassociate pass used to crash on these examples." |
test/Transforms/Reassociate/undef.ll | ||
---|---|---|
4 ↗ | (On Diff #18216) | Why should I add a Filecheck for a crash? I looked at what was done by other crash test in the test suite. Thanks! |
test/Transforms/Reassociate/undef.ll | ||
---|---|---|
4 ↗ | (On Diff #18216) | It's just improved testing. If you're going to add a test (which of course you have to), then you might as well make that test check for correctness rather than absence of incorrectness. I realize that there are existing tests that violate this principle. They can and should be improved when possible. In this case, you want something like (I didn't actually run this): CHECK-LABEL: @undef2( |
Update taking into account the review
(even though I'm not convince that sometime you *can* test something. Here for the first test the result is
ret float fadd (float undef, float fadd (float undef, float fadd (float fsub (float -0.000000e+00, float undef), float fsub (float -0.000000e+00, float undef))))
if someone improves Reassociate to fold undef that is equally fine in my opinion and we are just adding some maintenance burden/noise to update test.)
That's true, but:
- You don't have to fully specify each line of IR in your CHECKs.
- You didn't create the minimal test case to check your patch. I haven't looked into how this crashes, but this is certainly a smaller test case that still crashes: define float @undef1(float %x) { %y = fsub fast float undef, %x %z = fsub fast float undef, %y ret float %z }