[PATCH] D40061: [WIP] [ARM] Make MachineVerifier more strict about terminators

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 18:19:24 PST 2017


efriedma created this revision.
Herald added subscribers: JDevlieghere, kristof.beyls, javed.absar, aemerson.

Per a recent thread on llvmdev, MachineVerifier is a bit loose about the rule that terminators are always at the end of a basic block.  Fix the ARM backend's analyzeBranch so it doesn't ignore predicated return instructions, and make the MachineVerifier rule more strict.

WIP because I'm not happy with the change in the generated code for atomic-cmpxchg.ll.  IfConversion creates a BB which is a predicated return followed by an unconditional branch, and analyzeBranch can't analyze that, so we end up with a very stupid-looking branch after MachineBlockPlacement.  Maybe we should be putting the unconditional branch into a separate block?  Or should we be able to analyze the construct somehow?  Or should we be avoiding IfConversion in cases where we can't fall through?  (It might be possible to end up in a similar situation with a jump table branch followed by a unconditional branch, but I don't have a testcase for that.)


Repository:
  rL LLVM

https://reviews.llvm.org/D40061

Files:
  lib/CodeGen/MachineVerifier.cpp
  lib/Target/ARM/ARMBaseInstrInfo.cpp
  test/CodeGen/ARM/2013-05-05-IfConvertBug.ll
  test/CodeGen/ARM/atomic-cmpxchg.ll
  test/CodeGen/ARM/call-tc.ll
  test/CodeGen/ARM/cmpxchg-weak.ll
  test/CodeGen/ARM/code-placement.ll
  test/CodeGen/ARM/sched-it-debug-nodes.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40061.122957.patch
Type: text/x-patch
Size: 4547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171115/b9ce04ec/attachment.bin>


More information about the llvm-commits mailing list