diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2023-09-11 11:32:51 +0100 |
---|---|---|
committer | Jeremy Morse <jeremy.morse@sony.com> | 2023-09-11 11:48:45 +0100 |
commit | 6942c64e8128e4ccd891b813d0240f574f80f59e (patch) | |
tree | 260069ee9b03354505c8bc462ffc05ab8a82bae0 /llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp | |
parent | 3787fd942f3927345320cc97a479f13e44355805 (diff) | |
download | llvm-6942c64e8128e4ccd891b813d0240f574f80f59e.zip llvm-6942c64e8128e4ccd891b813d0240f574f80f59e.tar.gz llvm-6942c64e8128e4ccd891b813d0240f574f80f59e.tar.bz2 |
[NFC][RemoveDIs] Prefer iterator-insertion over instructions
Continuing the patch series to get rid of debug intrinsics [0], instruction
insertion needs to be done with iterators rather than instruction pointers,
so that we can communicate information in the iterator class. This patch
adds an iterator-taking insertBefore method and converts various call sites
to take iterators. These are all sites where such debug-info needs to be
preserved so that a stage2 clang can be built identically; it's likely that
many more will need to be changed in the future.
At this stage, this is just changing the spelling of a few operations,
which will eventually become signifiant once the debug-info bearing
iterator is used.
[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939
Differential Revision: https://reviews.llvm.org/D152537
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp index 901c5fc0..97cf583 100644 --- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp +++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp @@ -1593,8 +1593,8 @@ static void insertTrivialPHIs(CHRScope *Scope, // Insert a trivial phi for I (phi [&I, P0], [&I, P1], ...) at // ExitBlock. Replace I with the new phi in UI unless UI is another // phi at ExitBlock. - PHINode *PN = PHINode::Create(I.getType(), pred_size(ExitBlock), "", - &ExitBlock->front()); + PHINode *PN = PHINode::Create(I.getType(), pred_size(ExitBlock), ""); + PN->insertBefore(ExitBlock->begin()); for (BasicBlock *Pred : predecessors(ExitBlock)) { PN->addIncoming(&I, Pred); } |