diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 556dbf54ec..d4463c17a3 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -2401,9 +2401,8 @@ static bool isCheapEnoughToEvaluateUnconditionally(const Expr *E, CodeGenFunction &CGF) { E = E->IgnoreParens(); - // TODO: Allow anything we can constant fold to an integer or fp constant. - if (isa<IntegerLiteral>(E) || isa<CharacterLiteral>(E) || - isa<FloatingLiteral>(E)) + // Anything that is an integer or floating point constant is fine. + if (E->isConstantInitializer(CGF.getContext(), false)) return true; // Non-volatile automatic variables too, to get "cond ? X : Y" where |