This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Make branch funnels pass the machine verifier
ClosedPublic

Authored by thegameg on Nov 6 2018, 7:08 AM.

Details

Summary

We previously marked all the tests with branch funnels as -verify-machineinstrs=0.

This is an attempt to fix it.

  1. ICALL_BRANCH_FUNNEL has no defs. Mark it as let OutOperandList = (outs)
  1. After that we hit an assert:
Assertion failed: (Op.getValueType() != MVT::Other && Op.getValueType() != MVT::Glue && "Chain and glue operands should occur at end of operand list!"), function AddOperand, file /Users/francisvm/llvm/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp,
line 461.

The chain operand was added at the beginning of the operand list. Move that to the end.

  1. After that we hit another verifier issue in the pseudo expansion where the registers used in the cmps and jmps are not added to the livein lists. Add the EFLAGS to all the new MBBs that we create.

PR39436

Diff Detail

Event Timeline

thegameg created this revision.Nov 6 2018, 7:08 AM

We found that branch funnels performed worse than retpolines after PGO and devirtualization, maybe we should just remove branch funnels? what do you think Peter?

@pcc can you take a look? The same failure just popped up in the new devirt test I added today (test added in r364960, workaround added in r364997).

pcc accepted this revision.Jul 2 2019, 7:24 PM

LGTM

This revision is now accepted and ready to land.Jul 2 2019, 7:24 PM