LLVM  9.0.0svn
AArch64RedundantCopyElimination.cpp File Reference
#include "AArch64.h"
#include "llvm/ADT/Optional.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"
Include dependency graph for AArch64RedundantCopyElimination.cpp:

Go to the source code of this file.

## Macros

#define DEBUG_TYPE   "aarch64-copyelim"

## Functions

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. More...

## ◆ DEBUG_TYPE

 #define DEBUG_TYPE   "aarch64-copyelim"

Definition at line 64 of file AArch64RedundantCopyElimination.cpp.

## ◆ INITIALIZE_PASS()

 INITIALIZE_PASS ( AArch64RedundantCopyElimination , "aarch64-copyelim" , "AArch64 redundant copy elimination pass" , false , 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 109 of file AArch64RedundantCopyElimination.cpp.

## ◆ STATISTIC()

 STATISTIC ( NumCopiesRemoved , "Number of copies removed." )