[PATCH] D138784: [Coroutines] createStructType takes alignment in bits but receives bytes

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 02:58:43 PST 2022


gchatelet created this revision.
gchatelet added reviewers: ChuanqiXu, dblaikie.
Herald added a subscriber: hiraditya.
Herald added a project: All.
gchatelet requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This has been found while trying to remove the last few places relying on `unsigned` to convey alignment operations.
This seems to be untested.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138784

Files:
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp


Index: llvm/lib/Transforms/Coroutines/CoroFrame.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -895,7 +895,7 @@
   } else if (Ty->isStructTy()) {
     auto *DIStruct = Builder.createStructType(
         Scope, Name, Scope->getFile(), LineNum, Layout.getTypeSizeInBits(Ty),
-        Layout.getPrefTypeAlignment(Ty), llvm::DINode::FlagArtificial, nullptr,
+        Layout.getPrefTypeAlignment(Ty) * CHAR_BIT, llvm::DINode::FlagArtificial, nullptr,
         llvm::DINodeArray());
 
     auto *StructTy = cast<StructType>(Ty);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138784.478175.patch
Type: text/x-patch
Size: 649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221128/074f1fe8/attachment.bin>


More information about the llvm-commits mailing list