This is an archive of the discontinued LLVM Phabricator instance.

fix vectorization of library calls
AbandonedPublic

Authored by tim.schmielau on Sep 27 2022, 5:19 AM.

Details

Summary

Vectorization of library calls was unnecessarily fragile as
LoopAccessAnalysis would only consult the hardcoded list of
vectorizable functions for (call) instructions marked as potentially
reading from memory. However, few of the library functions in
llvm/include/llvm/Analysis/VecFuncs.def actually do that.

Thus commit ea75be3d9df448b6abafaf752a8141764d93ca33 and its
recommit 5f0a349738304caf5f8083166f785a91048f574d broke library
call vectorization by correctly declaring many library functions
as write only.

Apply the obvious fix of considering any call for vectorization,
not just those to functions that may read from memory.

Also change the libm-vector-calls tests so they would have
caught the issue.

Diff Detail

Event Timeline

tim.schmielau created this revision.Sep 27 2022, 5:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2022, 5:19 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
tim.schmielau requested review of this revision.Sep 27 2022, 5:19 AM
Matt added a subscriber: Matt.Sep 27 2022, 9:27 AM
RKSimon added inline comments.Sep 28 2022, 6:27 AM
llvm/lib/Analysis/LoopAccessAnalysis.cpp
2212

Drop the `Call &&` now that its inside the if()

  • Remove duplicate checks
tim.schmielau marked an inline comment as done.Sep 28 2022, 7:05 AM
tim.schmielau added inline comments.
llvm/lib/Analysis/LoopAccessAnalysis.cpp
2212

Oops, thanks.

tim.schmielau marked an inline comment as done.Sep 28 2022, 9:49 AM

Re-uploading patch after follow-on patch got mixed in

tim.schmielau updated this revision to Diff 463850.EditedSep 29 2022, 5:08 AM

Re-uploading once again. arc diff --preview creates a preview that looks correct, but just arc diff is somehow mixing in the other patch I currently have open on top of this one.

SGTM but I don't know this code particularly well - @fhahn any thoughts?

tim.schmielau abandoned this revision.Aug 11 2023, 5:30 AM

Superseded by D156478.