This is an archive of the discontinued LLVM Phabricator instance.

[Remarks] Provide more information about auto-init stores
ClosedPublic

Authored by thegameg on Feb 24 2021, 1:27 PM.

Details

Summary

This adds support for analyzing the instruction with the !annotation
"auto-init" in order to generate a more user-friendly remark.

For now, support the store size, and whether it's atomic/volatile.

Example:

auto-init.c:4:7: remark: Store inserted by -ftrivial-auto-var-init.Store size: 4 bytes. [-Rpass-missed=annotation-remarks]
  int var;
      ^

Diff Detail

Event Timeline

thegameg created this revision.Feb 24 2021, 1:27 PM
thegameg requested review of this revision.Feb 24 2021, 1:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2021, 1:27 PM
paquette added inline comments.Feb 24 2021, 3:26 PM
llvm/lib/Transforms/Utils/AutoInitRemark.cpp
30

I think it may be worth handling the false case here as well. People may want to search for non-volatile and non-atomic stores in the remarks.

thegameg added inline comments.Feb 24 2021, 3:50 PM
llvm/lib/Transforms/Utils/AutoInitRemark.cpp
30

In my experience volatile/atomic auto-init stores are very uncommon. While I agree that it's convenient for scripts and such to have it anyway, I wonder if it doesn't pollute the remark message too much.

Maybe I can put it under setExtraArgs...

thegameg updated this revision to Diff 326230.Feb 24 2021, 4:00 PM

Add StoreVolatile: false and StoreAtomic: false under ExtraArgs.

thegameg marked an inline comment as done.Feb 24 2021, 4:00 PM
thegameg added inline comments.
llvm/lib/Transforms/Utils/AutoInitRemark.cpp
30

Yep, that worked, thanks!

This revision is now accepted and ready to land.Feb 25 2021, 1:53 PM