OSDN Git Service

[PEI][NFC] Move StackSize opt-remark code next to -warn-stack code
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 5 Feb 2018 22:46:54 +0000 (22:46 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 5 Feb 2018 22:46:54 +0000 (22:46 +0000)
This allows us to make sure we're always having the same sizes in both
remarks and warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324283 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PrologEpilogInserter.cpp

index a8d8ad8..5e431f9 100644 (file)
@@ -227,6 +227,12 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
     DiagnosticInfoStackSize DiagStackSize(F, StackSize);
     F.getContext().diagnose(DiagStackSize);
   }
+  ORE->emit([&]() {
+    return MachineOptimizationRemarkAnalysis(DEBUG_TYPE, "StackSize",
+                                             Fn.getFunction().getSubprogram(),
+                                             &Fn.front())
+           << ore::NV("NumStackBytes", StackSize) << " stack bytes in function";
+  });
 
   delete RS;
   SaveBlocks.clear();
@@ -949,13 +955,6 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
   int64_t StackSize = Offset - LocalAreaOffset;
   MFI.setStackSize(StackSize);
   NumBytesStackSpace += StackSize;
-
-  ORE->emit([&]() {
-    return MachineOptimizationRemarkAnalysis(DEBUG_TYPE, "StackSize",
-                                             Fn.getFunction().getSubprogram(),
-                                             &Fn.front())
-           << ore::NV("NumStackBytes", StackSize) << " stack bytes in function";
-  });
 }
 
 /// insertPrologEpilogCode - Scan the function for modified callee saved