[cfe-commits] r59647 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/CodeGen/exprs.c

Nuno Lopes nunoplopes at sapo.pt
Wed Nov 19 09:44:31 PST 2008


Author: nlopes
Date: Wed Nov 19 11:44:31 2008
New Revision: 59647

URL: http://llvm.org/viewvc/llvm-project?rev=59647&view=rev
Log:
fix folding of '*doubleArray'

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp
    cfe/trunk/test/CodeGen/exprs.c

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=59647&r1=59646&r2=59647&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Nov 19 11:44:31 2008
@@ -972,6 +972,9 @@
 }
 
 bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
+  if (E->getOpcode() == UnaryOperator::Deref)
+    return false;
+
   if (!EvaluateFloat(E->getSubExpr(), Result, Info))
     return false;
 

Modified: cfe/trunk/test/CodeGen/exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exprs.c?rev=59647&r1=59646&r2=59647&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/exprs.c (original)
+++ cfe/trunk/test/CodeGen/exprs.c Wed Nov 19 11:44:31 2008
@@ -45,3 +45,10 @@
   if ((0, (int)a) & 2) { return 1; }
   return 2;
 }
+
+// this one shouldn't fold as well
+void eMaisUma() {
+	double t[1];
+	if (*t)
+		return;
+}





More information about the cfe-commits mailing list