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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 05:19:45 PDT 2025


================
@@ -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());
----------------
arsenm wrote:

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 

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


More information about the llvm-commits mailing list