[PATCH] D51030: [AArch64] Optimise load(adr address) to ldr address
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 28 12:58:38 PDT 2018
efriedma added inline comments.
================
Comment at: lib/Target/AArch64/AArch64InstrInfo.td:1900
+ if (auto *GV = dyn_cast<GlobalVariable>(G->getGlobal()))
+ Align = MF->getDataLayout().getPreferredAlignment(GV);
+ return Align >= 4 && G->getOffset() % 4 == 0;
----------------
I'd suggest just using `unsigned Align = G->getGlobal()->getPointerAlignment()` here, which should reliably do the right thing for all GlobalObjects.
Should be possible to match a global address node directly using something like the following:
```
def alignedglobaladdr : PatLeaf<(tglobaladdr), [{
auto *G = cast<GlobalAddressSDNode>(N);
// etc.
}]>;
```
https://reviews.llvm.org/D51030
More information about the llvm-commits
mailing list