This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][LoopStrengthReduction] Produce shorter expressions when using scev-based salvaging
ClosedPublic

Authored by chrisjackson on Aug 31 2021, 11:33 PM.

Details

Summary

The scev-based salvaging for LSR can sometimes produce unnecessarily verbose expressions. This patch adds logic to detect when the expression for the value to be recovered and the induction variable differ by only a constant offset, Then the expression to derive the current iteration count can be omitted from the dbg.value. This functionality is similar to the previous method for value recovery.

Diff Detail

Event Timeline

chrisjackson created this revision.Aug 31 2021, 11:33 PM
chrisjackson requested review of this revision.Aug 31 2021, 11:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2021, 11:33 PM

Updated diff so that it is based on the parent patch instead of the main branch,

chrisjackson retitled this revision from [DebugInfo][LoopStrengthReduction] Produce shorter expressions when using scev-based saslvaging to [DebugInfo][LoopStrengthReduction] Produce shorter expressions when using scev-based salvaging.Sep 2 2021, 2:55 AM
aprantl added inline comments.Sep 3 2021, 6:07 PM
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
6230

Does this mean the presence of debug info would change codegen?

chrisjackson added inline comments.Sep 7 2021, 1:47 AM
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
6230

No. I was using this return bool to check if debuginfo had changed, RewriteDVIUsingIterCount() has a similar return bool. However, the return values are currently unused. I will remove this return value for now as it seems its only use is to be possibly confusing.

Remove unused (and potentially confusing) bool return value from functions that rewrite the dbg.value intrinsics.

chrisjackson marked an inline comment as done.Sep 7 2021, 8:48 AM
aprantl accepted this revision.Sep 7 2021, 12:55 PM
This revision is now accepted and ready to land.Sep 7 2021, 12:55 PM

Required a minor modification as I realised the parent patch (D107016) was unnecessary

Applied clang-format.

This revision was landed with ongoing or failed builds.Sep 19 2021, 1:42 PM
This revision was automatically updated to reflect the committed changes.