[llvm] r360171 - [DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor

Jordan Rupprecht via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 12:58:43 PDT 2019


Looks like this causes some asan/msan crashes (or in some cases, test
failure/miscompiles). I'll see if I can get a crash with debug+asserts
enabled. In release mode, it's crashing during Machine InstCombiner/Live
Variable Analysis for different repros.


*From: *Florian Hahn via llvm-commits <llvm-commits at lists.llvm.org>
*Date: *Tue, May 7, 2019 at 9:45 AM
*To: * <llvm-commits at lists.llvm.org>

Author: fhahn
> Date: Tue May  7 09:47:27 2019
> New Revision: 360171
>
> URL: http://llvm.org/viewvc/llvm-project?rev=360171&view=rev
> Log:
> [DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor
>
> When simplifying TokenFactors, we potentially iterate over all
> operands of a large number of TokenFactors. This causes quadratic
> compile times in some cases and the large token factors cause additional
> scalability problems elsewhere.
>
> This patch adds some limits to the number of nodes explored for the
> cases mentioned above.
>
> Reviewers: niravd, spatel, craig.topper
>
> Reviewed By: niravd
>
> Differential Revision: https://reviews.llvm.org/D61397
>
> Modified:
>     llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=360171&r1=360170&r2=360171&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue May  7
> 09:47:27 2019
> @@ -1792,8 +1792,9 @@ SDValue DAGCombiner::visitTokenFactor(SD
>    TFs.push_back(N);
>
>    // Iterate through token factors.  The TFs grows when new token factors
> are
> -  // encountered.
> -  for (unsigned i = 0; i < TFs.size(); ++i) {
> +  // encountered. Limit number of nodes to inline, to avoid quadratic
> compile
> +  // times.
> +  for (unsigned i = 0; i < TFs.size() && Ops.size() <= 2048; ++i) {
>      SDNode *TF = TFs[i];
>
>      // Check each of the operands.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190510/76c503e2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4849 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190510/76c503e2/attachment-0001.bin>


More information about the llvm-commits mailing list