[llvm] [AArch64] New subtarget features to control ldp and stp formation, fo… (PR #66098)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 01:15:52 PDT 2023


================
@@ -2159,6 +2171,24 @@ bool AArch64LoadStoreOpt::tryToPairLdStInst(MachineBasicBlock::iterator &MBBI) {
     // Keeping the iterator straight is a pain, so we let the merge routine tell
     // us what the next instruction is after it's done mucking about.
     auto Prev = std::prev(MBBI);
+
+    // Get the needed alignments to check them if
+    // ldp-aligned-only/stp-aligned-only features are opted.
+    uint64_t MemAlignment = MemOp->getAlign().value();
----------------
davemgreen wrote:

This looks like it could be performed higher, up above the call to findMatchingInsn? So long as it doesn't need to check the second instruction in the pair too.

If so there are some other conditions checked in isCandidateToMergeOrPair. I'm not sure why they are separated out, but it might be good to keep those kinds of checks together in the same function.

https://github.com/llvm/llvm-project/pull/66098


More information about the llvm-commits mailing list