From f111d935722ed488144600cea5ed03a6b5069e8f Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 15 Apr 2011 00:35:48 +0000 Subject: C1X: implement generic selections As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprScalar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CGExprScalar.cpp') diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index a44c03ec11..556dbf54ec 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -163,6 +163,9 @@ public: Value *VisitParenExpr(ParenExpr *PE) { return Visit(PE->getSubExpr()); } + Value *VisitGenericSelectionExpr(GenericSelectionExpr *GE) { + return Visit(GE->getResultExpr()); + } // Leaves. Value *VisitIntegerLiteral(const IntegerLiteral *E) { @@ -2396,8 +2399,7 @@ Value *ScalarExprEmitter::VisitBinComma(const BinaryOperator *E) { /// flow into selects in some cases. static bool isCheapEnoughToEvaluateUnconditionally(const Expr *E, CodeGenFunction &CGF) { - if (const ParenExpr *PE = dyn_cast(E)) - return isCheapEnoughToEvaluateUnconditionally(PE->getSubExpr(), CGF); + E = E->IgnoreParens(); // TODO: Allow anything we can constant fold to an integer or fp constant. if (isa(E) || isa(E) || -- cgit v1.2.3