[clang] [clang][CodeGen] Add range metadata for atomic load of boolean type. #131476 (PR #133546)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 2 15:25:12 PDT 2025
Jan =?utf-8?q?Górski?= <jan.a.gorski at wp.pl>,
Jan =?utf-8?q?Górski?= <jan.a.gorski at wp.pl>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/133546 at github.com>
================
@@ -590,6 +590,29 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *E, Address Dest,
llvm::LoadInst *Load = CGF.Builder.CreateLoad(Ptr);
Load->setAtomic(Order, Scope);
Load->setVolatile(E->isVolatile());
+
+ if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0) {
+ CGF.Builder.CreateStore(Load, Dest);
+ return;
+ }
+
+ QualType Ty = E->getValueType();
+ if (!Ty->isBooleanType()) {
+ CGF.Builder.CreateStore(Load, Dest);
+ return;
----------------
efriedma-quic wrote:
Using an early return like this is weird; just stick a normal if statement around the code that creates the metadata.
https://github.com/llvm/llvm-project/pull/133546
More information about the cfe-commits
mailing list