diff options
author | Chris Jackson <chris.jackson@sony.com> | 2021-07-22 09:27:46 +0100 |
---|---|---|
committer | Chris Jackson <chris.jackson@sony.com> | 2021-07-27 13:00:36 +0100 |
commit | 76f3ffb2b285998f02639db8fd42fb0de8a540d0 (patch) | |
tree | 5ce9da40364159b2a9633b2c554c4f422e212864 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | 43e45f0ec920b45d6073c0aff47597c44948f52c (diff) | |
download | llvm-76f3ffb2b285998f02639db8fd42fb0de8a540d0.zip llvm-76f3ffb2b285998f02639db8fd42fb0de8a540d0.tar.gz llvm-76f3ffb2b285998f02639db8fd42fb0de8a540d0.tar.bz2 |
[DebugInfo][LoopStrengthReduction] SCEV-based salvaging for LSR
This patch extends salvaging of debuginfo in the Loop Strength Reduction
(LSR) pass by translating Scalar Evaluations (SCEV) into DIExpressions.
The method is as follows:
- Cache dbg.value intrinsics that are salvageable.
- Obtain a loop Induction Variable (IV) from ScalarExpressionExpander or
the loop header.
- Translate the IV SCEV into an expression that recovers the current
loop iteration count. Combine this with the dbg.value's location
op SCEV to create a DIExpression that salvages the value.
Review by: jmorse
Differential Revision: https://reviews.llvm.org/D105207
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 5af1c37..3978e1e 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -1393,9 +1393,10 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized, // can ensure that IVIncrement dominates the current uses. PostIncLoops = SavedPostIncLoops; - // Remember this PHI, even in post-inc mode. + // Remember this PHI, even in post-inc mode. LSR SCEV-based salvaging is most + // effective when we are able to use an IV inserted here, so record it. InsertedValues.insert(PN); - + InsertedIVs.push_back(PN); return PN; } |