This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Add a command line option to guard ReduceLoadOpStoreWidth
ClosedPublic

Authored by Carrot on May 28 2020, 10:55 AM.

Details

Summary

As discussed in the thread http://lists.llvm.org/pipermail/llvm-dev/2020-May/141838.html, some bit field access width can be reduced by ReduceLoadOpStoreWidth, some can't. If two accesses are very close, and the first access width is reduced, the second is not. Then the wide load of second access will be stalled for long time.

This patch guards the function ReduceLoadOpStoreWidth with a new command line option combiner-reduce-load-op-store-width, so it gives user a chance to disable ReduceLoadOpStoreWidth.

Diff Detail

Event Timeline

Carrot created this revision.May 28 2020, 10:55 AM
efriedma added inline comments.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15418

There are two separate transforms here: ShrinkLoadReplaceStoreWithStore, which actually erases the load, and the isNarrowingProfitable transform, which just shrinks the store. The performance implications might be different, so I think we want separate flags.

(We don't really want to encourage users to use these flags in production, but I think it's okay to add them to evaluate the performance impact.)

llvm/test/CodeGen/X86/clear-bitfield.ll
10

Probably we want to see what happens with i16 specifically, since there's some weirdness involving the encodings.

Please generate checks with update_llc_test_checks.py.

void added inline comments.May 28 2020, 3:31 PM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15418

Would using this flag in isNarrowingProfitable (or conditionalizing the execution of same with the flag) better?

(We don't really want to encourage users to use these flags in production, but I think it's okay to add them to evaluate the performance impact.)

Agreed. I think it's better to have a better heuristic to determine if narrowing is profitable.

Carrot updated this revision to Diff 267066.May 28 2020, 3:34 PM
Carrot marked 2 inline comments as done.
Carrot added inline comments.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15418

isNarrowingProfitable is also used to reduce load and other alu width, these don't stall following load.

I added a new flag to guard ShrinkLoadReplaceStoreWithStore.

This revision is now accepted and ready to land.May 28 2020, 5:36 PM
This revision was automatically updated to reflect the committed changes.