[clang] [clang][bytecode] Use IsNonNull opcode in CXXNewExpr (PR #221515)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 5 21:03:00 PDT 2026


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

Instead of emitting a null pointer and checking that for equality.

>From f4eefe774d20140c4adefbdb9c7a07cc115acb91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sun, 6 Sep 2026 06:01:57 +0200
Subject: [PATCH] [clang][bytecode] Use IsNonNull opcode in CXXNewExpr

Instead of emitting a null pointer and checking that for equality.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 03f9478a6e4e0..595a7744784bd 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4339,11 +4339,9 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
         if (IsNoThrow) {
           if (!this->emitDupPtr(E))
             return false;
-          if (!this->emitNullPtr(0, nullptr, E))
+          if (!this->emitIsNonNullPtr(E))
             return false;
-          if (!this->emitEQPtr(E))
-            return false;
-          if (!this->jumpTrue(EndLabel, E))
+          if (!this->jumpFalse(EndLabel, E))
             return false;
         }
 



More information about the cfe-commits mailing list