[PATCH] D76551: [Alignment][NFC] Use TFL::getStackAlign()

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 02:10:43 PDT 2020


courbet added inline comments.


================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:442
+        Align Alignment(RegInfo->getSpillAlignment(*RC));
+        Align StackAlign = TFI->getStackAlign();
 
----------------
inline this on the line below ?

`Alignment = std::min(Alignment, TFI->getStackAlign());`


================
Comment at: llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp:132
   // them.
+  Align StackAlign = TFI->getStackAlign();
   for (const BasicBlock &BB : *Fn) {
----------------
const, to make it clear that this does not change in the loop ?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4031
-      DAG.getSubtarget().getFrameLowering()->getStackAlignment();
-  if (Align <= StackAlign)
-    Align = 0;
----------------
I think it was clearer with this conditional here rather than inline later.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4037
+      DAG.getNode(ISD::ADD, dl, AllocSize.getValueType(), AllocSize,
+                  DAG.getConstant(StackAlign.value() - 1, dl, IntPtr), Flags);
 
----------------
extract `StackAlign.value() - 1` to a `StackAlignMask` variable for semantics ? Or maybe even add a `getMask()` method to `llvm::Align` given that this is a very common operation ? 


================
Comment at: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:548
       BuildMI(MBB, II, dl, TII.get(PPC::LI8), NegSizeReg)
-        .addImm(~(MaxAlign-1));
+          .addImm(~(MaxAlign.value() - 1));
 
----------------
would be useful here too.


================
Comment at: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:573
       BuildMI(MBB, II, dl, TII.get(PPC::LI), NegSizeReg)
-        .addImm(~(MaxAlign-1));
+          .addImm(~(MaxAlign.value() - 1));
 
----------------
and here


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76551/new/

https://reviews.llvm.org/D76551





More information about the llvm-commits mailing list