[PATCH] D19885: [AArch64] Decouple zero store promotion from narrow ld merge. NFC.
Jun Bum Lim via llvm-commits
llvm-commits at lists.llvm.org
Fri May 6 08:14:59 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268744: [AArch64] Decouple zero store promotion from narrow ld merge. NFC. (authored by junbuml).
Changed prior to commit:
http://reviews.llvm.org/D19885?vs=56048&id=56416#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19885
Files:
llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
Index: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -51,6 +51,10 @@
static cl::opt<unsigned> UpdateLimit("aarch64-update-scan-limit", cl::init(100),
cl::Hidden);
+static cl::opt<bool> EnableNarrowLdMerge("enable-narrow-ld-merge", cl::Hidden,
+ cl::init(true),
+ cl::desc("Enable narrow load merge"));
+
namespace llvm {
void initializeAArch64LoadStoreOptPass(PassRegistry &);
}
@@ -614,11 +618,14 @@
(UnscaledLdOffset + LoadSize <= (UnscaledStOffset + StoreSize));
}
-static bool isPromotableZeroStoreOpcode(MachineInstr *MI) {
- unsigned Opc = MI->getOpcode();
+static bool isPromotableZeroStoreOpcode(unsigned Opc) {
return isNarrowStore(Opc) || Opc == AArch64::STRWui || Opc == AArch64::STURWi;
}
+static bool isPromotableZeroStoreOpcode(MachineInstr *MI) {
+ return isPromotableZeroStoreOpcode(MI->getOpcode());
+}
+
static bool isPromotableZeroStoreInst(MachineInstr *MI) {
return (isPromotableZeroStoreOpcode(MI)) &&
getLdStRegOp(MI).getReg() == AArch64::WZR;
@@ -1722,36 +1729,17 @@
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
enableNarrowLdOpt && MBBI != E;) {
MachineInstr *MI = MBBI;
- switch (MI->getOpcode()) {
- default:
- // Just move on to the next instruction.
- ++MBBI;
- break;
- // Scaled instructions.
- case AArch64::LDRBBui:
- case AArch64::LDRHHui:
- case AArch64::LDRSBWui:
- case AArch64::LDRSHWui:
- case AArch64::STRBBui:
- case AArch64::STRHHui:
- case AArch64::STRWui:
- // Unscaled instructions.
- case AArch64::LDURBBi:
- case AArch64::LDURHHi:
- case AArch64::LDURSBWi:
- case AArch64::LDURSHWi:
- case AArch64::STURBBi:
- case AArch64::STURHHi:
- case AArch64::STURWi: {
+ unsigned Opc = MI->getOpcode();
+ if (isPromotableZeroStoreOpcode(Opc) ||
+ (EnableNarrowLdMerge && isNarrowLoad(Opc))) {
if (tryToMergeLdStInst(MBBI)) {
Modified = true;
- break;
- }
+ } else
+ ++MBBI;
+ } else
++MBBI;
- break;
- }
- }
}
+
// 3) Find loads and stores that can be merged into a single load or store
// pair instruction.
// e.g.,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19885.56416.patch
Type: text/x-patch
Size: 2528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160506/7b92f955/attachment.bin>
More information about the llvm-commits
mailing list