[cfe-commits] r129231 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/arm.cpp

Eli Friedman eli.friedman at gmail.com
Sat Apr 9 12:54:33 PDT 2011


Author: efriedma
Date: Sat Apr  9 14:54:33 2011
New Revision: 129231

URL: http://llvm.org/viewvc/llvm-project?rev=129231&view=rev
Log:
Make sure we or together the overflow flags of the multiply and add, so the
check is triggered appropriately.  Reported on cfe-dev.


Modified:
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/test/CodeGenCXX/arm.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=129231&r1=129230&r2=129231&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Sat Apr  9 14:54:33 2011
@@ -595,7 +595,7 @@
       Size = CGF.Builder.CreateExtractValue(AddRes, 0);
 
       llvm::Value *AddDidOverflow = CGF.Builder.CreateExtractValue(AddRes, 1);
-      DidOverflow = CGF.Builder.CreateAnd(DidOverflow, AddDidOverflow);
+      DidOverflow = CGF.Builder.CreateOr(DidOverflow, AddDidOverflow);
     }
 
     Size = CGF.Builder.CreateSelect(DidOverflow,

Modified: cfe/trunk/test/CodeGenCXX/arm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/arm.cpp?rev=129231&r1=129230&r2=129231&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/arm.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/arm.cpp Sat Apr  9 14:54:33 2011
@@ -117,7 +117,8 @@
     // CHECK: [[N:%.*]] = load i32*
     // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 4)
     // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8)
-    // CHECK: [[SZ:%.*]] = select
+    // CHECK: [[OR:%.*]] = or i1
+    // CHECK: [[SZ:%.*]] = select i1 [[OR]]
     // CHECK: call noalias i8* @_Znam(i32 [[SZ]])
     // CHECK: store i32 4
     // CHECK: store i32 [[N]]





More information about the cfe-commits mailing list