[clang] 4554c85 - [clang][bytecode] Use IsNonNull op in visitBool() (#139846)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 14 00:14:07 PDT 2025
Author: Timm Baeder
Date: 2025-05-14T09:14:03+02:00
New Revision: 4554c852398d0f6e46950e9bc51f74aa1b11b29a
URL: https://github.com/llvm/llvm-project/commit/4554c852398d0f6e46950e9bc51f74aa1b11b29a
DIFF: https://github.com/llvm/llvm-project/commit/4554c852398d0f6e46950e9bc51f74aa1b11b29a.diff
LOG: [clang][bytecode] Use IsNonNull op in visitBool() (#139846)
We don't need to emit the nullptr and compare to it anymore.
Added:
Modified:
clang/lib/AST/ByteCode/Compiler.cpp
Removed:
################################################################################
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