[cfe-commits] r60415 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGen/2008-12-02-logical-or-fold.c
Eli Friedman
eli.friedman at gmail.com
Tue Dec 2 08:03:17 PST 2008
Author: efriedma
Date: Tue Dec 2 10:02:46 2008
New Revision: 60415
URL: http://llvm.org/viewvc/llvm-project?rev=60415&view=rev
Log:
Fix for PR3150: obvious copy-paste bug in
ScalarExprEmitter::VisitBinLOr.
Added:
cfe/trunk/test/CodeGen/2008-12-02-logical-or-fold.c
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=60415&r1=60414&r2=60415&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Dec 2 10:02:46 2008
@@ -1077,9 +1077,9 @@
return Builder.CreateZExt(RHSCond, CGF.LLVMIntTy, "lor.ext");
}
- // 1 || RHS: If it is safe, just elide the RHS, and return 0.
+ // 1 || RHS: If it is safe, just elide the RHS, and return 1.
if (!CGF.ContainsLabel(E->getRHS()))
- return llvm::Constant::getNullValue(CGF.LLVMIntTy);
+ return llvm::ConstantInt::get(CGF.LLVMIntTy, 1);
}
llvm::BasicBlock *ContBlock = CGF.createBasicBlock("lor.end");
Added: cfe/trunk/test/CodeGen/2008-12-02-logical-or-fold.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-12-02-logical-or-fold.c?rev=60415&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2008-12-02-logical-or-fold.c (added)
+++ cfe/trunk/test/CodeGen/2008-12-02-logical-or-fold.c Tue Dec 2 10:02:46 2008
@@ -0,0 +1,4 @@
+// RUN: clang -emit-llvm -o - %s | grep "store i32 1"
+// PR3150
+
+int a() {return 1||1;}
More information about the cfe-commits
mailing list