HomePhabricator

CodeGenPrep: add separate hook say when GEPs should be used for sinking. NFCI.

Description

CodeGenPrep: add separate hook say when GEPs should be used for sinking. NFCI.

Up to now, we've decided whether to sink address calculations using GEPs or
normal arithmetic based on the useAA hook, but there are other reasons GEPs
might be preferred. So this patch splits the two questions, with a default
implementation falling back to useAA.

Details

Committed
tnorthoverSep 12 2019, 3:21 AM
Parents
rL371720: [clang-format] [PR43100] clang-format C# support does not add a space between…
Branches
Unknown
Tags
Unknown

Event Timeline

tberghammer added inline comments.
/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
4794–4795

What is the expected behavior here?

If --addr-sink-using-gep=false is not specified on the command line then AddrSinkUsingGEPs will be true so the second part of the condition will not be evaluated while if --addr-sink-using-gep=false is specified then !AddrSinkUsingGEPs.getNumOccurrences() will evaluate to false.

Based on the above this condition will always evaluate to AddrSinkUsingGEPs unless somebody changes the default value for it.