[PATCH] D67252: [IR] CallBrInst: scan+update arg list when indirect dest list changes

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 18:24:43 PDT 2019


nickdesaulniers created this revision.
nickdesaulniers added reviewers: craig.topper, chandlerc.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.
nickdesaulniers added a subscriber: void.

There's an unspoken invariant of callbr that the list of BlockAddress
Constants in the "function args" list match the BasicBlocks in the
"other labels" list. (This invariant is being added to the LangRef in
https://reviews.llvm.org/D67196).

When modifying the any of the indirect destinations of a callbr
instruction (possible jump targets), we need to update the function
arguments if the argument is a BlockAddress whose BasicBlock refers to
the indirect destination BasicBlock being replaced.  Otherwise, may
transforms that modify successors will end up violating that invariant.

A recent change to the arm64 Linux kernel exposed this bug.

Thanks to the following folks that reported the issue and helped debug
it:

- Nathan Chancellor
- Will Deacon
- Andrew Murray
- Craig Topper

Link: https://bugs.llvm.org/show_bug.cgi?id=43222
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Link: https://lists.infradead.org/pipermail/linux-arm-kernel/2019-September/678330.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67252

Files:
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp
  llvm/unittests/IR/InstructionsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67252.219020.patch
Type: text/x-patch
Size: 4926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190906/1401fed2/attachment.bin>


More information about the llvm-commits mailing list