[llvm] [llvm] Ensure propagated constants in the vtable are aligned (PR #136630)

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 16:09:39 PDT 2025


================
@@ -298,7 +302,9 @@ wholeprogramdevirt::findLowestOffset(ArrayRef<VirtualCallTarget> Targets,
           ++Byte;
         }
       }
-      return (MinByte + I) * 8;
+      // Rounding up ensures the constant is always stored at address we
+      // can directly load from without misalignment.
+      return RoundUp((MinByte + I) * 8, Size);
----------------
pcc wrote:

You can call alignTo here instead of introducing RoundUp.

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


More information about the llvm-commits mailing list