This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Revert "Prevent hoisting fmul from THEN/ELSE to IF if there is fmsub/fmadd opportunity."
Needs ReviewPublic

Authored by sebpop on Apr 21 2021, 8:23 AM.

Details

Summary

This reverts commit 543900539f7c166d453e5bd5175f9461dbbd4319.

As explained in https://reviews.llvm.org/D7299 this patch causes missed optimizations:
it disables simplifyCFG from hoisting fmul even when all uses of the multiply could be hoisted.

The side-effects of the patch do not justify the original motivation for the change:
"improved spec2006/soplex by 2% consistently on cortex-a57 core"

One example where this change is harmful is https://github.com/ispc/ispc/issues/2052
where ISPC generates similar code on both branches and relies on simplifyCFG to remove the branch.
The branch is removed only after the arm64 back-end pairs fmul+fadd
and after that, there are not enough scalar optimizations to clean up the code.

A better solution is to make instruction selection work on multiple basic-blocks
such that it can decide to sink and fuse multiplies to form FMAs.

Tested on arm64-linux.

Diff Detail

Event Timeline

sebpop created this revision.Apr 21 2021, 8:23 AM
sebpop requested review of this revision.Apr 21 2021, 8:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 8:23 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp