[Verifier] add invariant check for callbr
authorNick Desaulniers <ndesaulniers@google.com>
Wed, 25 Sep 2019 22:28:27 +0000 (22:28 +0000)
committerNick Desaulniers <ndesaulniers@google.com>
Wed, 25 Sep 2019 22:28:27 +0000 (22:28 +0000)
commit93d87260f1f7b5ec6775fe88891e47a57e6392d6
tree00cec6aacace958a220e73a6e01671176798fb8b
parent6023cf223446e3f7038d4b867635f47b2d26e194
[Verifier] add invariant check for callbr

Summary:
The list of indirect labels should ALWAYS have their blockaddresses as
argument operands to the callbr (but not necessarily the other way
around).  Add an invariant that checks this.

The verifier catches a bad test case that was added recently in r368478.
I think that was a simple mistake, and the test was made less strict in
regards to the precise addresses (as those weren't specifically the
point of the test).

This invariant will be used to find a reported bug.

Link: https://www.spinics.net/lists/arm-kernel/msg753473.html
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Reviewers: craig.topper, void, chandlerc

Reviewed By: void

Subscribers: ychen, lebedev.ri, javed.absar, kristof.beyls, hiraditya, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67196

llvm-svn: 372923
llvm/docs/LangRef.rst
llvm/lib/IR/Verifier.cpp
llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
llvm/test/Verifier/callbr.ll [new file with mode: 0644]