[clang] [CIR] Fix order of creation so that lit test will not fail (PR #226706)
Jan Leyonberg via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 26 08:02:24 PDT 2026
https://github.com/jsjodin created https://github.com/llvm/llvm-project/pull/226706
This patch fixes the order of creation, otherwise the compiler may evaluate one before the other and the lit test fail.
>From d189bca6ebb646c5faf6816b641e5ff87b026c6c Mon Sep 17 00:00:00 2001
From: Jan Leyonberg <jan_sjodin at yahoo.com>
Date: Sat, 26 Sep 2026 10:57:44 -0400
Subject: [PATCH] [CIR] Fix order of creation so that lit test will not fail
This patch fixes the order of creation, otherwise the compiler may evaluate one
before the other and the lit test fail.
---
.../Transforms/TargetLowering/CIRABIRewriteContext.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp b/clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
index a9f73e667f1f3..a7639abb62466 100644
--- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
@@ -1897,8 +1897,9 @@ mlir::Value copyRegisterToTemp(CIRBaseBuilderTy &b, mlir::Location loc,
loc, b.createPtrBitcast(regAddr, f.ac.coercedType), 8);
mlir::Value dst = temp;
if (f.ac.directOffset) {
- dst = b.createPtrStride(loc, b.createPtrBitcast(temp, byteTy),
- b.getSignedInt(loc, f.ac.directOffset, 32));
+ mlir::Value tempByte = b.createPtrBitcast(temp, byteTy);
+ mlir::Value offset = b.getSignedInt(loc, f.ac.directOffset, 32);
+ dst = b.createPtrStride(loc, tempByte, offset);
}
b.createStore(loc, val, b.createPtrBitcast(dst, f.ac.coercedType));
return b.createPtrBitcast(temp, byteTy);
More information about the cfe-commits
mailing list