This is an archive of the discontinued LLVM Phabricator instance.

Map LLVM values to corresponding source-level expressions
Needs ReviewPublic

Authored by phyBrackets on Aug 25 2023, 12:54 PM.

Details

Summary

The primary objective of this project is to enhance the effectiveness of compiler-generated remarks and analysis reports for code optimization. These messages, while often comprehensive, lack direct connections to the corresponding source-level expressions. The goal is to bridge this gap by utilizing LLVM's intrinsic functions, which establish mappings between LLVM program entities and source-level expressions. The project specifically focuses on utilizing these intrinsic functions to generate or derive source expressions from LLVM values. This functionality is particularly important for enhancing memory access optimizations, including the reporting of memory access dependences that hinder vectorization.

The core achievement of the project is the development of an analysis pass that operates on LLVM intermediate representation (IR). This analysis pass identifies load and store instructions, and then conducts a recursive traversal to construct source expressions that represent equivalent source-level memory references. This is achieved by utilizing the metadata and debug intrinsics available in the LLVM IR. This pass was integrated into the loop vectorizer framework, which is a significant step towards practical application. Accompanying the implementation, a comprehensive suite of tests was developed to ensure the accuracy and expected behavior of the analysis pass.

This work is done under Google Summer Of Code , Project link https://discourse.llvm.org/t/map-llvm-values-to-corresponding-source-level-expressions/68450 ,

I am hoping for the better review on this patch and future of this analysis pass. I would highly recommend to look at this final report for much better idea about the implementation and what we lacking right now https://docs.google.com/document/d/1t1K6vzCYDnFBTH8d1NIJInhxRe5mc1FxkMaX_2WVcmc/edit?usp=sharing

Diff Detail

Event Timeline

phyBrackets created this revision.Aug 25 2023, 12:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 12:54 PM
phyBrackets requested review of this revision.Aug 25 2023, 12:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 12:54 PM

@fhahn the changes here are a first step towards adding equivalent source expressions in compiler generated optimization analysis remarks where appropriate. In our experience, customers have found such information useful. Can you let us know your thoughts and add other reviewers that you think are appropriate? The new information is only added when the user opts-in to see the same. The generated source expressions are not perfect and we can consider making the opt-in the default as we refine and improve the implementation.

Added @hnrklssn who had worked on a similar project in the past as a reviewer.