[cfe-commits] r162545 - in /cfe/trunk: lib/Analysis/CFG.cpp test/Sema/warn-unreachable.c

Chris Lattner clattner at apple.com
Mon Aug 27 22:10:11 PDT 2012


On Aug 26, 2012, at 11:37 PM, Ted Kremenek <kremenek at apple.com> wrote:

> On Aug 25, 2012, at 12:09 PM, Chris Lattner <clattner at apple.com> wrote:
> 
>>> Teach CFG that 'if (x & 0)' and 'if (x * 0)' is an unfeasible branch.
>> 
>> Why not teach the general front-end constant folding logic (in lib/AST/ExprConstant.cpp) to handle this identity, and then just use it?
> 
> I may have misunderstood the point of ExprConstant, but I thought it's semantics are tied to restrictions on what we can consider an integer constant expression.  Is that not the case?

The "Expr::isIntegerConstantExpr" and "isCXX11ConstantExpr" are limited to folding exactly what the standards spec specifies.  EvaluateAsRValue and EvaluateAsInt can use "any crazy technique that we want to" :-)

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120827/3d905dbd/attachment.html>


More information about the cfe-commits mailing list