[clang] [CIR] Pointer and vptr width from a CIR-native data-layout entry (PR #204185)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 08:39:15 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/test/CIR/CodeGen/pointer-width-32bit.cpp clang/lib/CIR/CodeGen/CIRGenerator.cpp clang/lib/CIR/Dialect/IR/CIRTypes.cpp clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenerator.cpp b/clang/lib/CIR/CodeGen/CIRGenerator.cpp
index a9ffece66..61efaebad 100644
--- a/clang/lib/CIR/CodeGen/CIRGenerator.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenerator.cpp
@@ -45,11 +45,12 @@ static void setMLIRDataLayout(mlir::ModuleOp &mod, const llvm::DataLayout &dl) {
       mlir::translateDataLayout(dl, mlirContext);
 
   // Add a CIR-native pointer data-layout entry so cir.ptr / cir.vptr size and
-  // alignment are driven by the data layout rather than hardcoded. 
+  // alignment are driven by the data layout rather than hardcoded.
   // The value stores {size-in-bits, abi-align-in-bits} keyed on cir.ptr.
   //
-  // TODO(cir): Only the default address space is recorded and address-space-dependent
-  // pointer sizes are not modeled yet. Emit per-address-space entries.
+  // TODO(cir): Only the default address space is recorded and
+  // address-space-dependent pointer sizes are not modeled yet. Emit
+  // per-address-space entries.
   assert(!cir::MissingFeatures::dataLayoutPtrHandlingBasedOnLangAS());
   constexpr unsigned kBitsInByte = 8;
   unsigned ptrSizeBits = dl.getPointerSizeInBits(/*AS=*/0);

``````````

</details>


https://github.com/llvm/llvm-project/pull/204185


More information about the cfe-commits mailing list