[clang] [clang][bytecode] Use IsNonNull op in visitBool() (PR #139846)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Tue May 13 22:06:11 PDT 2025
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?= <tbaeder at 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)
More information about the cfe-commits
mailing list