[cfe-commits] r141701 - in /cfe/trunk/lib: AST/StmtPrinter.cpp CodeGen/CGExpr.cpp

David Blaikie dblaikie at gmail.com
Tue Oct 11 14:35:59 PDT 2011


>
> -  llvm::BasicBlock *MonotonicBB, *AcquireBB, *ReleaseBB, *AcqRelBB,
> *SeqCstBB;
> +  llvm::BasicBlock *MonotonicBB = 0, *AcquireBB = 0, *ReleaseBB = 0,
> +                   *AcqRelBB = 0, *SeqCstBB = 0;
>

Just curious -  why were these all declared up-front like this, rather than
at the scopes they were used? You don't seem to actually use the null values
at all & duplicate the condition basically like:

T *x;
stuff1();
if (cond)
  x = init();
stuff2();
if (cond)
  use(x)

rather than

stuff1();
stuff2();
if (cond) {
  T *x = init();
  use(x);
}

seems like excess scope, initialization, etc - or is there a reason the
basic blocks need to be constructed in a particular order up front? (I had a
patch to move these initializations/declarations down as in my second
example but I didn't get around to running the tests on it to see if the
block creation order change broke anything)

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111011/06f53189/attachment.html>


More information about the cfe-commits mailing list