[PATCH] D143386: Add function pointer alignment to DataLayout

Guillaume Chatelet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 7 08:21:14 PST 2023


gchatelet added a comment.
Herald added a subscriber: jobnoorman.

In D143386#4107144 <https://reviews.llvm.org/D143386#4107144>, @efriedma wrote:

> Almost all the specifications you're specifying are wrong.  Very few targets should be using "i".  Off the top of my head, 32-bit ARM, MIPS targets with MicroMIPS, and certain PowerPC targets should, but most common targets shouldn't.  ("i" means that either the target mangles the bottom bits of function pointers, or function pointers don't point directly at code.)

Ok so I misunderstood the meaning of "i" then.

> And the x86 doesn't specify 4-byte alignment.

I thought that specifying it in the `DataLayout` would help getting rid of the special handling in ConstantFold <https://github.com/llvm/llvm-project/blob/308e82ecebeef1342004637db9fdf11567a299b3/llvm/lib/IR/ConstantFold.cpp#L1085-L1095>. I'm confused now.

> For each target, we should try to handle the LLVM backend at the same time...

I'm not familiar with this part of the codebase as you can tell. Would you have any pointers to the backend part that needs to be updated?
Shall we try to do one target at a time then?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143386/new/

https://reviews.llvm.org/D143386



More information about the cfe-commits mailing list