summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2008-11-19 17:44:31 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2008-11-19 17:44:31 +0000
commit0e33c688d519bffe80ef2b45a5c7107ebaf7d9cf (patch)
tree253a4b405780633f953534767386b1c78b86d09b
parent7768a30c3740b59809a33fdf296dfc3489a88e0e (diff)
downloadbcm5719-llvm-0e33c688d519bffe80ef2b45a5c7107ebaf7d9cf.tar.gz
bcm5719-llvm-0e33c688d519bffe80ef2b45a5c7107ebaf7d9cf.zip
fix folding of '*doubleArray'
llvm-svn: 59647
-rw-r--r--clang/lib/AST/ExprConstant.cpp3
-rw-r--r--clang/test/CodeGen/exprs.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index ef8e2d4c130..6b71d110043 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -972,6 +972,9 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
}
bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
+ if (E->getOpcode() == UnaryOperator::Deref)
+ return false;
+
if (!EvaluateFloat(E->getSubExpr(), Result, Info))
return false;
diff --git a/clang/test/CodeGen/exprs.c b/clang/test/CodeGen/exprs.c
index 275c988ab9b..07a9158744b 100644
--- a/clang/test/CodeGen/exprs.c
+++ b/clang/test/CodeGen/exprs.c
@@ -45,3 +45,10 @@ int ola() {
if ((0, (int)a) & 2) { return 1; }
return 2;
}
+
+// this one shouldn't fold as well
+void eMaisUma() {
+ double t[1];
+ if (*t)
+ return;
+}
OpenPOWER on IntegriCloud