[LoopVectorize] use IR fast-math-flags exclusively (not FP function attributes)
authorSanjay Patel <spatel@rotateright.com>
Wed, 27 Jan 2021 19:11:22 +0000 (14:11 -0500)
committerSanjay Patel <spatel@rotateright.com>
Wed, 27 Jan 2021 19:17:11 +0000 (14:17 -0500)
commitab93c18c125f0ee51959ef225fa8f09f4dc29e35
treebb99e18f1b022770b67478730bca9332cea23f40
parentd90bb66dd931a45cae3399dc76942bf8e412fa7b
[LoopVectorize] use IR fast-math-flags exclusively (not FP function attributes)

I am trying to untangle the fast-math-flags propagation logic
in the vectorizers (see a6f022127 for SLP).

The loop vectorizer has a mix of checking FP function attributes,
IR-level FMF, and just wrong assumptions.

I am trying to avoid regressions while fixing this, and I think
the IR-level logic is good enough for that, but it's hard to say
for sure. This would be the 1st step in the clean-up.

The existing test that I changed to include 'fast' actually shows
a miscompile: the function only had the equivalent of nnan, but we
created new instructions that had fast (all FMF set). This is
similar to the example in https://llvm.org/PR35538

Differential Revision: https://reviews.llvm.org/D95452
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/test/Transforms/LoopVectorize/X86/float-induction-x86.ll
llvm/unittests/Transforms/Vectorize/VPlanTest.cpp