<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 15, 2013 at 12:55 PM, Sebastian Pop <span dir="ltr"><<a href="mailto:spop@codeaurora.org" target="_blank" class="cremed">spop@codeaurora.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>+<br>
+  /// The <span>ScevRewriter</span> takes a scalar evolution expression and copies all its<br>
+  /// components. The result after a rewrite is an identical SCEV.<br>
+  struct <span>ScevRewriter</span><br>
+    : public SCEVVisitor<<span>ScevRewriter</span>, const SCEV*> {</div></blockquote></div><br>This class seems to have a pretty weird design to me... So the base class is a CRTP visitor, and this class is then derived again, and many of the visit methods are now virtual.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">It seems like the better design would be to use consistent CRTP explicit delegation for the entire type hierarchy instead of using a mixture of CRTP and virtual dispatch.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">In particular, virtual dispatch is remarkably inefficient for visitor patterns where you really want the inliner to be able to form a jump-table-loop.</div></div>