<div style="font-family: arial, helvetica, sans-serif"><font size="2"><div class="gmail_quote">On Mon, Jun 25, 2012 at 2:26 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:arial,helvetica,sans-serif"><font size="2"><div class="gmail_quote"><div class="im">On Mon, Jun 25, 2012 at 2:21 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: efriedma<br>
Date: Mon Jun 25 16:21:08 2012<br>
New Revision: 159161<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=159161&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=159161&view=rev</a><br>
Log:<br>
Use std::map instead of llvm::DenseMap because we rely on the stability of references to values in these maps. PR13197.<br></blockquote><div><br></div></div><div>Would it be better to use a vector for storage and a densemap of pointer->pointer?</div>
</div></font></div></blockquote><div><br></div><div>Obviously, a vector doesn't work for the same reason a densemap doesn't...</div><div><br></div><div>However, we could model a reference as a stable index into a vector, or use a deque-like storage system, potentially even a bumpptrallocator...</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:arial,helvetica,sans-serif"><font size="2"><div class="gmail_quote">
<div><br></div><div>In the past this has been somewhat performance sensitive.</div><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
<br>
Added:<br>
    cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp<br>
Modified:<br>
    cfe/trunk/lib/AST/ExprConstant.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/ExprConstant.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=159161&r1=159160&r2=159161&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=159161&r1=159160&r2=159161&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)<br>
+++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Jun 25 16:21:08 2012<br>
@@ -287,7 +287,9 @@<br>
     /// parameters' function scope indices.<br>
     const APValue *Arguments;<br>
<br>
-    typedef llvm::DenseMap<const Expr*, APValue> MapTy;<br>
+    // Note that we intentionally use std::map here so that references to<br>
+    // values are stable.<br>
+    typedef std::map<const Expr*, APValue> MapTy;<br>
     typedef MapTy::const_iterator temp_iterator;<br>
     /// Temporaries - Temporary lvalues materialized within this stack frame.<br>
     MapTy Temporaries;<br>
@@ -361,7 +363,9 @@<br>
     /// NextCallIndex - The next call index to assign.<br>
     unsigned NextCallIndex;<br>
<br>
-    typedef llvm::DenseMap<const OpaqueValueExpr*, APValue> MapTy;<br>
+    // Note that we intentionally use std::map here so that references<br>
+    // to values are stable.<br>
+    typedef std::map<const OpaqueValueExpr*, APValue> MapTy;<br>
     /// OpaqueValues - Values used as the common expression in a<br>
     /// BinaryConditionalOperator.<br>
     MapTy OpaqueValues;<br>
<br>
Added: cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp?rev=159161&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp?rev=159161&view=auto</a><br>


==============================================================================<br>
--- cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp (added)<br>
+++ cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp Mon Jun 25 16:21:08 2012<br>
@@ -0,0 +1,42 @@<br>
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s<br>
+// PR13197<br>
+<br>
+struct type1<br>
+{<br>
+  constexpr type1(int a0) : my_data{a0} {}<br>
+  int my_data[1];<br>
+};<br>
+<br>
+struct type2<br>
+{<br>
+  typedef type1 T;<br>
+  constexpr type2(T a00, T a01, T a02, T a03, T a04, T a05, T a06, T a07, T a08, T a09,<br>
+                       T a10, T a11, T a12, T a13, T a14, T a15, T a16, T a17, T a18, T a19,<br>
+                       T a20, T a21, T a22)<br>
+    : my_data{a00, a01, a02, a03, a04, a05, a06, a07, a08, a09,<br>
+              a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,<br>
+              a20, a21, a22}<br>
+  {}<br>
+  type1 my_data[23];<br>
+};<br>
+<br>
+struct type3<br>
+{<br>
+  constexpr type3(type2 a0, type2 a1) : my_data{a0, a1} {}<br>
+  type2 my_data[2];<br>
+};<br>
+<br>
+constexpr type3 g<br>
+{<br>
+  {<br>
+   {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},<br>
+   {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},<br>
+   {0},{0},{0}<br>
+  },<br>
+  {<br>
+   {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},<br>
+   {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},<br>
+   {0},{0},{0}<br>
+  }<br>
+};<br>
+<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div><br></font></div>
</blockquote></div><br></font></div>