[PATCH] D23067: TargetInstrInfo: add two new target hooks to analyse branch offsets

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 11:51:38 PDT 2016


arsenm added inline comments.

================
Comment at: include/llvm/Target/TargetInstrInfo.h:486-488
@@ +485,5 @@
+
+  /// Return the opcode if there exist a branch instruction with a smaller
+  /// encoding, or -1 otherwise.
+  virtual int optimizeShortBranch(MachineInstr &MI, int64_t Offset) const {
+    return -1;
----------------
I think the design of this one is too restrictive, since it implies the branch can be optimized by simply changing the instruction opcode. I would expect such a simple change be handled by MC. If you still need the MI transformation, it would be better to expect the target to modify the branch (or insert a new instruction sequence to replace it) so that the target is free to change the operand structure or whatever else it needs to do


https://reviews.llvm.org/D23067





More information about the llvm-commits mailing list