[PATCH] D29344: [AArch64] Extend redundant copy elimination pass to handle non-zero stores.
Jun Bum Lim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 10:54:04 PST 2017
junbuml added a comment.
LGTM
================
Comment at: lib/Target/AArch64/AArch64RedundantCopyElimination.cpp:115
+/// branch \p CondBr jumps and whos equality comparison is against a constant.
+/// If true, return the compare instruction the branch is predicated upon.
+/// Otherwise, return nullptr.
----------------
This return the compare instruction the branch is predicated upon.
================
Comment at: lib/Target/AArch64/AArch64RedundantCopyElimination.cpp:214
+ --Itr;
+ dbgs() << "Itr: " << *Itr << '\n';
+ if (guaranteesZeroRegInBlock(*Itr, MBB)) {
----------------
Please remove it.
================
Comment at: lib/Target/AArch64/AArch64RedundantCopyElimination.cpp:215-226
+ if (guaranteesZeroRegInBlock(*Itr, MBB)) {
+ // Itr is a CBZ/CBNZ in this context.
+ MCPhysReg KnownReg = Itr->getOperand(0).getReg();
+ KnownRegs.push_back(RegImm(KnownReg, 0));
+ FirstUse = Itr;
+ } else if (MachineInstr *Cmp = knownRegValInBlock(*Itr, MBB)) {
+ // Itr is a conditional branch (i.e., Bcc) and Cmp is a compare
----------------
Isn't it possible to merge the "if" and "else if" block as these two block do almost the same thing ? Maybe move guaranteesZeroRegInBlock() in knownRegValInBlock() ?
https://reviews.llvm.org/D29344
More information about the llvm-commits
mailing list