Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline

Map LLVM values to corresponding source-level expressions
Needs ReviewPublic

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



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 ,

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

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.