[cfe-commits] r47971 - /cfe/trunk/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Wed Mar 5 14:59:42 PST 2008


Author: kremenek
Date: Wed Mar  5 16:59:42 2008
New Revision: 47971

URL: http://llvm.org/viewvc/llvm-project?rev=47971&view=rev
Log:
Added transfer function support for __builtin_expect.

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47971&r1=47970&r2=47971&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Wed Mar  5 16:59:42 2008
@@ -517,8 +517,21 @@
       
       IdentifierInfo* Info = cast<lval::FuncVal>(L).getDecl()->getIdentifier();
       
-      if (Info->getBuiltinID())
-        invalidateArgs = true;
+      if (unsigned id = Info->getBuiltinID()) {
+        switch (id) {
+          case Builtin::BI__builtin_expect: {
+            // For __builtin_expect, just return the value of the subexpression.
+            assert (CE->arg_begin() != CE->arg_end());            
+            RVal X = GetRVal(St, *(CE->arg_begin()));
+            Nodify(Dst, CE, *DI, SetRVal(St, CE, X));
+            continue;            
+          }
+            
+          default:
+            invalidateArgs = true;
+            break;
+        }
+      }
     }
         
     if (invalidateArgs) {





More information about the cfe-commits mailing list