[PATCH] [TargetInstrInfo] Add new hook: AnalyzeBranchPredicate.

Andrew Trick atrick at apple.com
Fri Jun 12 16:45:40 PDT 2015


Looks good but I have one comment inline...


================
Comment at: lib/Target/X86/X86InstrInfo.cpp:3640-3641
@@ +3639,4 @@
+  MBP.ConditionDef = &*DefFlagsI;
+  MBP.SingleUseCondition = CondBranches.size() == 1 &&
+                           CondBranches[0]->killsRegister(X86::EFLAGS, TRI);
+
----------------
This looks strange to me. Do you really need to prove that the ConditionDef only has a single use? If so, I think you should:

- check that EFLAGS is not live into any successors

- Walk backward from the branch looking for a Def of EFLAGS before any other use of EFLAGS.

You may have EFLAGS readers other than conditional branches.
killsRegister is a crutch that should be avoided whenever possible. It might not be accurate.

http://reviews.llvm.org/D10200

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list