summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-02-13 00:10:10 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-02-13 00:10:10 +0000
commitd5c9399696ab770579d3de9847b4d86ce3c5eb80 (patch)
tree655d2be7dab4bbe03dc24728fda7344455f39f16 /clang/lib/AST/ExprConstant.cpp
parent18c28f6cdc932b23d095fb6542d139f78b901a5e (diff)
downloadbcm5719-llvm-d5c9399696ab770579d3de9847b4d86ce3c5eb80.tar.gz
bcm5719-llvm-d5c9399696ab770579d3de9847b4d86ce3c5eb80.zip
Fix for PR6274: teach constant folding to evaluate __builtin_expect.
llvm-svn: 96054
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 382bfe59b5b..1a44cd02d9c 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -812,7 +812,7 @@ public:
return false;
}
- bool VisitCallExpr(const CallExpr *E);
+ bool VisitCallExpr(CallExpr *E);
bool VisitBinaryOperator(const BinaryOperator *E);
bool VisitUnaryOperator(const UnaryOperator *E);
bool VisitConditionalOperator(const ConditionalOperator *E);
@@ -967,7 +967,7 @@ static int EvaluateBuiltinClassifyType(const CallExpr *E) {
return -1;
}
-bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
+bool IntExprEvaluator::VisitCallExpr(CallExpr *E) {
switch (E->isBuiltinCall(Info.Ctx)) {
default:
return Error(E->getLocStart(), diag::note_invalid_subexpr_in_ice, E);
@@ -1022,6 +1022,9 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
Operand = Info.Ctx.Target.getEHDataRegisterNumber(Operand);
return Success(Operand, E);
}
+
+ case Builtin::BI__builtin_expect:
+ return Visit(E->getArg(0));
}
}
OpenPOWER on IntegriCloud