[llvm] [X86] Avoid useless DomTree in flags copy lowering (PR #97628)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 06:40:46 PDT 2024


================
@@ -258,13 +258,32 @@ bool X86FlagsCopyLoweringPass::runOnMachineFunction(MachineFunction &MF) {
   MRI = &MF.getRegInfo();
   TII = Subtarget->getInstrInfo();
   TRI = Subtarget->getRegisterInfo();
-  MDT = &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
   PromoteRC = &X86::GR8RegClass;
 
   if (MF.empty())
     // Nothing to do for a degenerate empty function...
     return false;
 
+  if (none_of(MRI->def_instructions(X86::EFLAGS), [](const MachineInstr &MI) {
+        return MI.getOpcode() == TargetOpcode::COPY;
----------------
phoebewang wrote:

Why don't check `MI.getOperand(0).getReg() == X86::EFLAGS` as well?

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


More information about the llvm-commits mailing list