This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking][InstCombine] Fix infinite min/max canonicalization loop (PR44541)
ClosedPublic

Authored by nikic on Feb 2 2020, 8:45 AM.

Details

Summary

While D72944 also fixes https://bugs.llvm.org/show_bug.cgi?id=44541, it does so in a more roundabout manner and there might be other loopholes to trigger the same issue. This is a more direct fix that does not recognize min/max in SPF if it is based on a non-canonical sub X, 0 instruction.

Diff Detail

Event Timeline

nikic created this revision.Feb 2 2020, 8:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2020, 8:45 AM
spatel added a comment.Feb 4 2020, 9:05 AM

Is there a way to solve this in InstCombine instead? We don't really want to cripple ValueTracking only because InstCombine has a problem with (the correct) analysis; ValueTracking can be used by other passes.

nikic updated this revision to Diff 243375.Feb 8 2020, 8:53 AM

Move the check to InstCombine instead.

spatel accepted this revision.Feb 8 2020, 10:39 AM

LGTM

This revision is now accepted and ready to land.Feb 8 2020, 10:39 AM
This revision was automatically updated to reflect the committed changes.