This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Fix logical and/or reductions.
ClosedPublic

Authored by ABataev on Oct 26 2021, 10:26 AM.

Details

Summary

Need to emit select(cmp) instructions for poison-safe forms of select
ops. Currently alive reports that Target is more poisonous than source
for operations we generating for such instructions.
https://alive2.llvm.org/ce/z/FiNiAA

Diff Detail

Event Timeline

ABataev created this revision.Oct 26 2021, 10:26 AM
ABataev requested review of this revision.Oct 26 2021, 10:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2021, 10:26 AM
ABataev edited the summary of this revision. (Show Details)Oct 26 2021, 10:40 AM

@spatel Any comments?

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8019

I'm not sure if I like the double fallthrough tbh, and I'd expect static analyzers to warn about the repeated if() - are adding extra 'return Builder.CreateBinOp' that bad?

spatel added inline comments.Oct 26 2021, 1:41 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8019

Yes - we already have that structure for min/max below here, so we might as well do the same for these cases.

llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll
477

We should also have a 'logical-or' test so we have coverage for that path.

ABataev added inline comments.Oct 26 2021, 1:57 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8019

Will fix it, no problem

llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll
477

Ok, will add

ABataev updated this revision to Diff 382457.Oct 26 2021, 2:09 PM

Address comments

spatel accepted this revision.Oct 26 2021, 3:34 PM

LGTM

This revision is now accepted and ready to land.Oct 26 2021, 3:34 PM
This revision was landed with ongoing or failed builds.Oct 27 2021, 4:26 AM
This revision was automatically updated to reflect the committed changes.