1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/unittests/IR
Nick Desaulniers c07423a078 [IR] CallBrInst: scan+update arg list when indirect dest list changes
Summary:
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, many
transforms that modify successors will end up violating that invariant.
A recent change to the arm64 Linux kernel exposed this bug, which
prevents the kernel from booting.

I considered maintaining a mapping from indirect destination BasicBlock
to argument operand BlockAddress, but this ends up being a one to
potentially many (though usually one) mapping.  Also, the list of
arguments to a function (or more typically inline assembly) ends up
being less than 10.  The implementation is significantly simpler to just
rescan the full list of arguments. Because of the one to potentially
many relationship, the full arg list must be scanned (we can't stop at
the first instance).

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

Reviewers: craig.topper, chandlerc

Reviewed By: craig.topper

Subscribers: void, javed.absar, kristof.beyls, hiraditya, llvm-commits, nathanchance, srhines

Tags: #llvm

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

llvm-svn: 371262
2019-09-06 21:50:11 +00:00
..
AsmWriterTest.cpp IR: Cleanup after test to silence ASAN builds 2019-08-03 15:40:00 +00:00
AttributesTest.cpp Reapply: IR: add optional type to 'byval' function parameters 2019-05-30 18:48:23 +00:00
BasicBlockTest.cpp [opaque pointer types] Pass function types to CallInst creation. 2019-02-01 20:43:25 +00:00
CFGBuilder.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
CFGBuilder.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt Scalable Vector IR Type with further LTO fixes 2019-07-05 12:48:16 +00:00
ConstantRangeTest.cpp [ConstantRange] Add sdiv() support 2019-06-03 18:19:54 +00:00
ConstantsTest.cpp Add FNeg IR constant folding support 2019-05-05 16:07:09 +00:00
DataLayoutTest.cpp [LLVM][Alignment] Introduce Alignment Type in DataLayout 2019-08-05 09:00:43 +00:00
DebugInfoTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DebugTypeODRUniquingTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DominatorTreeBatchUpdatesTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DominatorTreeTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FunctionTest.cpp [IR] Add getArg() method to Function class 2019-08-01 15:31:40 +00:00
InstructionsTest.cpp [IR] CallBrInst: scan+update arg list when indirect dest list changes 2019-09-06 21:50:11 +00:00
IntrinsicsTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IRBuilderTest.cpp [FPEnv] Teach the IRBuilder about constrained FPToSI and FPToUI. 2019-09-06 18:04:34 +00:00
LegacyPassManagerTest.cpp Fix IR/Analysis layering issue with OptBisect 2019-02-28 04:00:55 +00:00
ManglerTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MDBuilderTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MetadataTest.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
ModuleTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PassBuilderCallbacksTest.cpp [NewPassManager] Adding pass tuning options: loop vectorize. 2019-04-19 16:11:59 +00:00
PassManagerTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PatternMatch.cpp [IR][PatternMatch] Introduce m_NegatedPower2() matcher 2019-07-25 13:34:24 +00:00
TimePassesTest.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
TypesTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UserTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ValueHandleTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ValueMapTest.cpp Replace non-recursive sys::Mutex users with std::mutex 2019-08-07 11:59:44 +00:00
ValueTest.cpp [LLVM][Alignment] Introduce Alignment In GlobalObject 2019-08-06 09:03:21 +00:00
VectorTypesTest.cpp Scalable Vector IR Type with further LTO fixes 2019-07-05 12:48:16 +00:00
VerifierTest.cpp [opaque pointer types] Add a FunctionCallee wrapper type, and use it. 2019-02-01 02:28:03 +00:00
WaymarkTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00