Long compile-time cause by memory instructions with multiple machine memory operands

Hi,
i noticed a compilation time issue in some examples and it seems to be caused by checking aliasing information for instructions with multiple memory operands,

those instructions are a result of merging 4 memory instructions with adjacent memory and the memory operand of each instruction was transferred to the merge instruction (i guess they reference adjacent memory)

i see that most of the compile time is in building the scheduling DAG, and more specifically in mayAlias function,

any suggestions on how to handle this issue without badly hurting the performance by losing aliasing information?

Thanks,
Muhammad

Is there any additional you could provide, like a profile of where exactly the time is spent or an IR file to reproduce?

most of the time is spent building the scheduling Dag, mainly in this function BasicAAResult::DecomposeGEPExpression

which is called through similar call tree to this:
addChainDependencies → ScheduleDAGInstrs::addChainDependency → MachineInstr::mayAlias → MemOperandsHaveAlias → isNoAlias

i’m working on a target which is not present in the LLVM open source,
the issues happens in the machine IR,
when i have for example machine block with 100 store instructions each has 4 Machine memory operands,

most of the memory operands (in different instructions) don’t alias each other,

so i get many calls for each pair of instructions to AliasAnalysis::isNoAlias function

i noticed this target hook getMemOperandAACheckLimit() in TargetInstrInfo.h, when i decrease its return value to 1, i see noticeable improvement in compilation time but it hurts the performance badly in other tests which don’t have this issue