[InstCombine] intersect FMF when reassociating FP min/max intrinsics
authorSanjay Patel <spatel@rotateright.com>
Fri, 24 Apr 2020 15:59:15 +0000 (11:59 -0400)
committerSanjay Patel <spatel@rotateright.com>
Fri, 24 Apr 2020 16:14:03 +0000 (12:14 -0400)
commite4175ff5256126aa1b851cbe9579f1b62121aa48
treef05d7d5772e2319ff4c47b271e02ecea7350a6e6
parent1fcd234ac54a0bb9dcb14338db5a336d80321662
[InstCombine] intersect FMF when reassociating FP min/max intrinsics

As discussed in PR45478:
https://bugs.llvm.org/show_bug.cgi?id=45478
...propagating FMF from the outer (second) call is not correct,
so intersect them instead.
I suspect we could do better (see TODO comment), but mismatched
FMF is probably too rare to care about.

Differential Revision: https://reviews.llvm.org/D78631
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/maximum.ll
llvm/test/Transforms/InstCombine/maxnum.ll
llvm/test/Transforms/InstCombine/minimum.ll
llvm/test/Transforms/InstCombine/minnum.ll