[clang] [CIR] Fix order of creation so that lit test will not fail (PR #226706)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 26 08:03:03 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Jan Leyonberg (jsjodin)
<details>
<summary>Changes</summary>
This patch fixes the order of creation, otherwise the compiler may evaluate one before the other and the lit test fail.
---
Full diff: https://github.com/llvm/llvm-project/pull/226706.diff
1 Files Affected:
- (modified) clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp (+3-2)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/226706
More information about the cfe-commits
mailing list