[PATCH] D26704: [MemorySSA] Fix for non-determinism in codegen

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 15:31:39 PST 2016


dberlin added a comment.

First, thanks for doing this.



================
Comment at: lib/Transforms/Utils/MemorySSA.cpp:1472
   SmallVector<BasicBlock *, 32> IDFBlocks;
   IDFs.calculate(IDFBlocks);
 
----------------
I can find nowhere where this can possibly matter.
The uses in calculate are:
 for (BasicBlock *BB : *DefBlocks) {
    if (DomTreeNode *Node = DT.getNode(BB))
      PQ.push(std::make_pair(Node, DomLevels.lookup(Node)));
  }

(the PQ is ordered anyway, and in the end, the end result ordering is irrelevant) ...)
...
        if (!DefBlocks->count(SuccBB))

...

I do not believe fixing this or iterateddominancefrontiers makes sense.
We do not want to slow down phi placement, either.
Further, MemorySSA has one phi node per block, so i also can't see how it changes the IR.

I suspect this is papering over something else, so i'll take a look.

Note that we could sort them in bb numbering order in the end if we wanted to anyway, so if we really wanted a deterministic order, we'd do that.

(This is what promotememorytoregister does)


https://reviews.llvm.org/D26704





More information about the llvm-commits mailing list