[PATCH] D18235: [LTO] Call the optimizer before invoking codegen

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 15:15:06 PDT 2016


rafael added inline comments.

================
Comment at: ELF/SymbolTable.cpp:144
@@ +143,3 @@
+  // For now we just blatantly mimic the gold plugin in LLVM, running
+  // exactly the same passes. We might re-evaluate this in the future.
+  M.setDataLayout(TM->createDataLayout());
----------------
I think we should keep doing what gold does.

What I would have a FIXME for is refactoring this to avoid code duplication.

================
Comment at: ELF/SymbolTable.cpp:145
@@ +144,3 @@
+  // exactly the same passes. We might re-evaluate this in the future.
+  M.setDataLayout(TM->createDataLayout());
+  legacy::PassManager ltoPasses;
----------------
You don't need this.

================
Comment at: ELF/SymbolTable.cpp:146
@@ +145,3 @@
+  M.setDataLayout(TM->createDataLayout());
+  legacy::PassManager ltoPasses;
+  ltoPasses.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
----------------
Start variables with an upper case letter.

================
Comment at: ELF/SymbolTable.cpp:147
@@ +146,3 @@
+  legacy::PassManager ltoPasses;
+  ltoPasses.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
+  PassManagerBuilder PMB;
----------------
This line is too long. Please run git-clang-format.

================
Comment at: test/ELF/lto/ltopasses-basic.ll:3
@@ +2,3 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared
+; RUN: llvm-readobj -sections %t.so | FileCheck %s
----------------
Please use -save-temps.

That way you test it and it is a more direct check aynway.

================
Comment at: test/ELF/lto/ltopasses-basic.ll:15
@@ +14,3 @@
+; The llvm.global_ctors is unused and therefore it can be stripped from
+; the produced shared library. Ensure it doesn't appear in the final output.
+; CHECK-NOT: Name: .ctors
----------------
I agree with silvas' wording.


http://reviews.llvm.org/D18235





More information about the llvm-commits mailing list