https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/139846

We don't need to emit the nullptr and compare to it anymore.

>From 0339fcfd54521c35b3612e2c91805dc179ed9fe7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com>
Date: Wed, 14 May 2025 06:57:55 +0200
Subject: [PATCH] [clang][bytecode] Use IsNonNull op in visitBool()

We don't need to emit the nullptr and compare to it anymore.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index c7fb5e8466686..96ae1f58ef4a6 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4107,11 +4107,8 @@ template <class Emitter> bool 
Compiler<Emitter>::visitBool(const Expr *E) {
     return true;
 
   // Convert pointers to bool.
-  if (T == PT_Ptr) {
-    if (!this->emitNull(*T, 0, nullptr, E))
-      return false;
-    return this->emitNE(*T, E);
-  }
+  if (T == PT_Ptr)
+    return this->emitIsNonNullPtr(E);
 
   // Or Floats.
   if (T == PT_Float)

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to