[PATCH] D24108: X86: Fold tail calls into conditional branches where possible (PR26302)

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 17:48:37 PDT 2016


mkuper added a comment.

Thanks Hans, this looks much nicer!


================
Comment at: lib/Target/X86/X86InstrInfo.cpp:4079
@@ -4010,2 +4078,3 @@
+
 // Given a MBB and its TBB, find the FBB which was a fallthrough MBB (it may
 // not be a fallthrough MBB now due to layout changes). Return nullptr if the
----------------
Sorry, I got confused.
X86InstrInfo::AnalyzeBranchImpl() also returns a vector of MachineInstructions, but the analyzeBranch() interface doesn't expose that, only the MachineOperands. How inconvenient.
Anything we can do about this, or do you think it would be better not to touch this?

================
Comment at: lib/Target/X86/X86MCInstLower.cpp:509
@@ +508,3 @@
+    switch (MI->getOperand(1).getImm()) {
+    case X86::COND_O:  Opcode = X86::JO_1;  goto SetTailJmpOpcode;
+    case X86::COND_NO: Opcode = X86::JNO_1; goto SetTailJmpOpcode;
----------------
Can you use X86::GetCondBranchFromCond()?


https://reviews.llvm.org/D24108





More information about the llvm-commits mailing list