[llvm-dev] CGP: Break use-def graph loops in optimizeMemoryInst

Serguei Katkov via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 29 20:47:38 PDT 2017


Dear Community,

I'm trying to implement optimization described in PR26223 and meet the following bail out condition in CodeGenPrepare::optimizeMemoryInst.

    // Break use-def graph loops.
    if (!Visited.insert(V).second) {
      Consensus = nullptr;
      break;
    }

So while traversing thorough phi nodes from memory instruction to find addr mode we bail out if we meet some instruction twice.
Does anybody know/remember what is the reason for this checks.
>From the first glance it seems that it will be ok if we just mark it as visited and continue processing worklist.
I did this change and make check passed.

So I seek for a help to explain this decision.

Thank you in advance,
Serguei.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170630/922c2573/attachment.html>


More information about the llvm-dev mailing list