LLVM 19.0.0git
Macros | Functions
AArch64RedundantCopyElimination.cpp File Reference
#include "AArch64.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/LiveRegUnits.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"

Go to the source code of this file.


#define DEBUG_TYPE   "aarch64-copyelim"


 STATISTIC (NumCopiesRemoved, "Number of copies removed.")
 INITIALIZE_PASS (AArch64RedundantCopyElimination, "aarch64-copyelim", "AArch64 redundant copy elimination pass", false, false) bool AArch64RedundantCopyElimination
 It's possible to determine the value of a register based on a dominating condition.

Macro Definition Documentation


#define DEBUG_TYPE   "aarch64-copyelim"

Definition at line 63 of file AArch64RedundantCopyElimination.cpp.

Function Documentation


INITIALIZE_PASS ( AArch64RedundantCopyElimination  ,
"aarch64-copyelim"  ,
"AArch64 redundant copy elimination pass"  ,
false  ,

It's possible to determine the value of a register based on a dominating condition.

To do so, this function checks to see if the basic block MBB is the target of a conditional branch CondBr with an equality comparison. If the branch is a CBZ/CBNZ, we know the value of its source operand is zero in MBB for some cases. Otherwise, we find and inspect the NZCV setting instruction (e.g., SUBS, ADDS). If this instruction defines a register other than WZR/XZR, we know the value of the destination register is zero in MMB for some cases. In addition, if the NZCV setting instruction is comparing against a constant we know the other source register is equal to the constant in MBB for some cases. If we find any constant values, push a physical register and constant value pair onto the KnownRegs vector and return true. Otherwise, return false if no known values were found.

Definition at line 108 of file AArch64RedundantCopyElimination.cpp.

References llvm::LiveRegUnits::accumulateUsedDefed(), assert(), llvm::LiveRegUnits::available(), llvm::MachineBasicBlock::begin(), CC, llvm::LiveRegUnits::clear(), llvm::AArch64CC::EQ, llvm::MachineBasicBlock::getParent(), llvm::make_range(), MBB, llvm::AArch64CC::NE, llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::rend(), and TRI.


STATISTIC ( NumCopiesRemoved  ,
"Number of copies removed."