[PATCH] [PR20893] Change SelectionDAG's DbgValueMap to have set semantics (NFC)

Adrian Prantl aprantl at apple.com
Mon Sep 22 13:36:57 PDT 2014


Hi echristo, dblaikie, friss,

The attached patch changes the DbgValMap to have set semantics, which fixes the excessive memory allocation followed by a crash reported in PR20893. (http://llvm.org/bugs/show_bug.cgi?id=20893)
When SelectionDAG is combining two SDNodes and then merging their DbgValues via DAG.TransferDbgValues(), SelectionDAG::AddDbgValue() doesn't check whether a DbgValue is already in that SDNode's list of DbgValues and happily adds all of them. In cases like the one in the PR, this can lead to a pathological situation where — when dagcombining a long chain of instructions — the SDNode's DbgValMap is growing exponentially.

http://reviews.llvm.org/D5451

Files:
  include/llvm/CodeGen/SelectionDAG.h
  lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5451.13956.patch
Type: text/x-patch
Size: 4170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140922/ed871aa1/attachment.bin>


More information about the llvm-commits mailing list