InstSimplify: Require instruction be parented
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 23 May 2023 09:28:57 +0000 (10:28 +0100)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 2 Jun 2023 22:14:28 +0000 (18:14 -0400)
commit1536e299e63d7788f38117b0212ca50eb76d7a3b
tree3e8a95e6e2798f366769d6b817b34cdbe678388d
parent12d967c95f1633bebd1b225ddd53573951a7ca43
InstSimplify: Require instruction be parented

Unlike every other analysis and transform, simplifyInstruction
permitted operating on instructions which are not inserted
into a function. This created an edge case no other code needs
to really worry about, and limited transforms in cases that
can make use of the context function. Only the inliner and a handful
of other utilities were making use of this, so just fix up these
edge cases. Results in some IR ordering differences since
cloned blocks are inserted eagerly now. Plus some additional
simplifications trigger (e.g. some add 0s now folded out that
previously didn't).
16 files changed:
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/Analysis/InstructionSimplify.h
llvm/include/llvm/IR/BasicBlock.h
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/IR/BasicBlock.cpp
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/Inline/inline_inv_group.ll
llvm/test/Transforms/Inline/simplify-instruction-computeKnownFPClass-context.ll
llvm/test/Transforms/LoopRotate/pr56260.ll
llvm/test/Transforms/SampleProfile/profile-context-tracker-debug.ll
llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-matching.ll
llvm/test/Transforms/SimplifyCFG/pr46638.ll
llvm/unittests/Transforms/Utils/LocalTest.cpp