]> granicus.if.org Git - llvm/commit
[LoopVectorize] Fix assertion failure in Fcmp vectorization
authorAnna Thomas <anna@azul.com>
Tue, 8 Aug 2017 18:07:44 +0000 (18:07 +0000)
committerAnna Thomas <anna@azul.com>
Tue, 8 Aug 2017 18:07:44 +0000 (18:07 +0000)
commit04285488393616bbb9c13960af2db5b90f7b498c
tree4a3d9c0520935423841ac2d5d3273f8bc61923f0
parenteb72b7e53dfc6531e35145494985dea061b1ecb2
[LoopVectorize] Fix assertion failure in Fcmp vectorization

Summary:
When vectorizing fcmps we can trip on incorrect cast assertion when setting the
FastMathFlags after generating the vectorized FCmp.
This can happen if the FCmp can be folded to true or false directly. The fix
here is to set the FastMathFlag using the FastMathFlagBuilder *before* creating
the FCmp Instruction. This is what's done by other optimizations such as
InstCombine.
Added a test case which trips on cast assertion without this patch.

Reviewers: Ayal, mssimpso, mkuper, gilr

Reviewed by: Ayal, mssimpso

Subscribers: llvm-commits, mzolotukhin

Differential Revision: https://reviews.llvm.org/D36244

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310389 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/fcmp-vectorize.ll [new file with mode: 0644]