[llvm] [MTE] generalize overalignment / size of MTE globals (PR #121957)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 08:27:30 PST 2025


================
@@ -2398,17 +2398,23 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
   OutStreamer->emitBinaryData(Buf);
 }
 
-static void tagGlobalDefinition(Module &M, GlobalVariable *G) {
-  Constant *Initializer = G->getInitializer();
+static uint64_t globalSize(const GlobalVariable &G) {
+  const Constant *Initializer = G.getInitializer();
   uint64_t SizeInBytes =
-      M.getDataLayout().getTypeAllocSize(Initializer->getType());
----------------
jrtc27 wrote:

Why did this use the initialiser rather than GV->getValueType? They should be the same but it seems odd to not ask about the global itself.

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


More information about the llvm-commits mailing list