[PATCH] D82977: [Alignment][NFC] Transition and simplify calls to DL::getABITypeAlignment

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 09:42:38 PDT 2020


gchatelet marked 5 inline comments as done.
gchatelet added inline comments.
Herald added a subscriber: wuzish.


================
Comment at: llvm/lib/Target/X86/X86FastISel.cpp:1326
-  unsigned ABIAlignment = DL.getABITypeAlignment(LI->getType());
-  if (Alignment == 0) // Ensure that codegen never sees alignment 0
-    Alignment = ABIAlignment;
----------------
`LI->getAlign()` is always `>0`, removing the need for `getABITypeAlignment` altogether.


================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:223
-      if (Align1 != Align2) {
-        if (!Align1 || !Align2) {
-          const DataLayout &DL = Caller->getParent()->getDataLayout();
----------------
`Align1` and `Align2` are always `>0` so this whole block can be stripped away.
This translates to:
```
if (Align1 != Align2) {
  if (Align1 > Align2)
    AvailableAlloca->setAlignment(AI->getAlign());
}
```
Which is equivalent to:
```
  if (Align1 > Align2)
    AvailableAlloca->setAlignment(AI->getAlign());
```


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1375
-    Align = LI.getAlignment();
-    if (Align == 0)
-      Align = DL.getABITypeAlignment(LI.getType());
----------------
Again `Align` cannot to `0`


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:1946
-        unsigned InstAlignment = Load->getAlignment();
-        if (!InstAlignment)
-          InstAlignment =
----------------
ditto


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:1977
-        unsigned InstAlignment = Store->getAlignment();
-        if (!InstAlignment)
-          InstAlignment =
----------------
ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82977





More information about the llvm-commits mailing list