[PATCH] D19338: New code hoisting pass based on GVN (optimistic approach)

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 08:02:58 PDT 2016


sebpop added a comment.

In http://reviews.llvm.org/D19338#410725, @bcahoon wrote:

> Also, I did see one test failure due to infinite recursion caused by some odd looking IR as input to the pass.   The odd IR is generated by the jump threading pass.
>
>   for.cond:                                         ; preds = %for.cond
>     %inc113 = add nsw i32 %inc113, 1
>     br label %for.cond
>


The recursion is in llvm::GVN::ValueTable::lookup_or_add of %inc113 that is defined
recursively.  As our pass is now value numbering all the program, it will try to VN this
variable and it will start the infinite recursion.

We could change the way we iterate over the CFG to only walk through BBs reachable from the function entry.
Another work around is to add -simplifycfg to remove the dead code.
The fix is to detect self-defined variables in GVN.cpp.


http://reviews.llvm.org/D19338





More information about the llvm-commits mailing list