Fix for PR3150: obvious copy-paste bug in 
ScalarExprEmitter::VisitBinLOr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60415 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 8c4303b..7f417b3 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -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");
diff --git a/test/CodeGen/2008-12-02-logical-or-fold.c b/test/CodeGen/2008-12-02-logical-or-fold.c
new file mode 100644
index 0000000..ba8f86c
--- /dev/null
+++ b/test/CodeGen/2008-12-02-logical-or-fold.c
@@ -0,0 +1,4 @@
+// RUN: clang -emit-llvm -o - %s | grep "store i32 1"
+// PR3150
+
+int a() {return 1||1;}