Page MenuHomePhabricator

[MLGO] Add LoopPropertiesAnalysis pass
Needs ReviewPublic

Authored by eopXD on Nov 19 2022, 4:38 PM.

Details

Summary

This pass mimics FunctionPropertiesAnalysis.

The analysis will be used to extract features from loop. The follow-up
patches will be extending MLGO onto helping the loop partial unroll
decision, using this pass to extract features of a loop.

Diff Detail

Unit TestsFailed

TimeTest
41,500 msx64 debian > libFuzzer.libFuzzer::fork.test
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/SimpleTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fork.test.tmp-SimpleTest
60,060 msx64 debian > libFuzzer.libFuzzer::minimize_crash.test
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/NullDerefTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/minimize_crash.test.tmp-NullDerefTest
60,040 msx64 debian > libFuzzer.libFuzzer::value-profile-load.test
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LoadTest.cpp -fsanitize-coverage=trace-gep -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/value-profile-load.test.tmp-LoadTest

Event Timeline

eopXD created this revision.Nov 19 2022, 4:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 4:38 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
eopXD requested review of this revision.Nov 19 2022, 4:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 4:38 PM
eopXD added a comment.Nov 19 2022, 4:53 PM
This comment was removed by eopXD.
eopXD retitled this revision from [MLGO] Add LoopPropertiesAnalysis and its printer pass to [MLGO] Add LoopPropertiesAnalysis pass.Nov 19 2022, 4:55 PM
eopXD edited the summary of this revision. (Show Details)
eopXD updated this revision to Diff 485222.Dec 24 2022, 11:42 PM

Rebase upon latest main.

Generally looks good. Two minor comments.

llvm/include/llvm/Analysis/LoopPropertiesAnalysis.h
51

This bool and the one above are not strictly needed, one can just check the size and APInt for their value.

llvm/lib/Analysis/LoopPropertiesAnalysis.cpp
72

It is probably better to do the checks via isa<CastInst> and similar. New stuff is added and this seems hard to maintain.