[PATCH] D73727: [SLP] drop poison-generating flags for shuffle reduction ops (PR44536)
authorSanjay Patel <spatel@rotateright.com>
Fri, 31 Jan 2020 14:37:47 +0000 (09:37 -0500)
committerSanjay Patel <spatel@rotateright.com>
Fri, 31 Jan 2020 14:54:35 +0000 (09:54 -0500)
commitbc1148e7bcb0448d765aff9078d480ff1905ea1b
treef3a5312d097d11d114fa7154ce8b2b95e4fcb839
parent33f65f393f6652a0974582f7b13a9aa38a9929a3
[PATCH] D73727: [SLP] drop poison-generating flags for shuffle reduction ops (PR44536)

We may calculate reassociable math ops in arbitrary order when creating a shuffle reduction,
so there's no guarantee that things like 'nsw' hold on those intermediate values. Drop all
poison-generating flags for safety.

This change is limited to shuffle reductions because I don't think we have a problem in the
general case (where we intersect flags of each scalar op that goes into a vector op), but if
there's evidence of other cases being wrong, we can extend this fix to cover those cases.

https://bugs.llvm.org/show_bug.cgi?id=44536

Differential Revision: https://reviews.llvm.org/D73727
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/test/Transforms/SLPVectorizer/X86/horizontal.ll
llvm/test/Transforms/SLPVectorizer/X86/remark_horcost.ll
llvm/test/Transforms/SLPVectorizer/X86/scheduling.ll