[llvm] [llvm] Optimize MachineMemOperand::getAlign with KnownBits information (PR #143872)

Acthinks Yang via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 06:11:18 PDT 2025


Acthinks wrote:

Yes, handling it at the IR stage is more reasonable. Thank you!


发件人:"Matt Arsenault" ***@***.***>
发送日期:2025-06-12 20:20:01
收件人:llvm/llvm-project ***@***.***>
抄送人:"Acthinks Yang" ***@***.***>, Author ***@***.***>
主 题:Re: [llvm/llvm-project] [llvm] Optimize MachineMemOperand::getAlign with KnownBits information (PR #143872)


@arsenm commented on this pull request.

In llvm/lib/CodeGen/MachineOperand.cpp:

> @@ -1136,7 +1137,20 @@ void MachineMemOperand::refineAlignment(const MachineMemOperand *MMO) {
 /// getAlign - Return the minimum known alignment in bytes of the
 /// actual memory reference.
 Align MachineMemOperand::getAlign() const {
-  return commonAlignment(getBaseAlign(), getOffset());
+  Align RetAlign = commonAlignment(getBaseAlign(), getOffset());


This should remain a trivial getter. We don't want fancy optimizations down here, these should be applied somewhere else. In particular we shouldn't need to look at the underlying IR to improve the alignment at this point, the middle end should have refined the alignment already

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>

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


More information about the llvm-commits mailing list