From 34a38d8efbde085814bbbb5d1d7c7fcb15897e42 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Fri, 2 May 2014 00:05:16 +0000 Subject: MS ABI: Fix logic bug in member pointer null test code This code is trying to test if the pointer is *not* null. Therefore we should use 'or' instead of 'and' to combine the results of 'icmp ne'. This logic is consistent with the general member pointer comparison code in EmitMemberPointerComparison. llvm-svn: 207815 --- clang/lib/CodeGen/MicrosoftCXXABI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/MicrosoftCXXABI.cpp') diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 528cdf6238e..869734ab4e4 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1628,7 +1628,7 @@ MicrosoftCXXABI::EmitMemberPointerIsNotNull(CodeGenFunction &CGF, for (int I = 1, E = fields.size(); I < E; ++I) { llvm::Value *Field = Builder.CreateExtractValue(MemPtr, I); llvm::Value *Next = Builder.CreateICmpNE(Field, fields[I], "memptr.cmp"); - Res = Builder.CreateAnd(Res, Next, "memptr.tobool"); + Res = Builder.CreateOr(Res, Next, "memptr.tobool"); } return Res; } -- cgit v1.2.3