This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer][NFCi] SValBuilder: Simlify a SymExpr to the absolute simplest form
ClosedPublic

Authored by martong on Dec 2 2021, 1:50 AM.

Details

Summary

Move the SymExpr simplification fixpoint logic into SValBuilder.

Strictly speaking, this is not an NFC, however, I could not synthesize a test that could demonstrate any functional change. The only difference compared to the baseline is where the actual simplification happens.

Diff Detail

Event Timeline

martong created this revision.Dec 2 2021, 1:50 AM
martong requested review of this revision.Dec 2 2021, 1:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2021, 1:50 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Measurement results are attached, I think there is no relevant difference.

I don't think there is any time concern with this patch. It's NFC. You should retitle accordingly.

clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
51

What about calling this simplifySValOnce()

1137

You can remove this comment. Not really useful anyway.

martong updated this revision to Diff 391352.Dec 2 2021, 9:15 AM
martong marked 2 inline comments as done.
  • Rename simplifySValImpl to simplifySValOnce
  • Remove a comment
martong added inline comments.Dec 3 2021, 1:04 AM
clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
51

Sounds better!

1137

Ok.

martong retitled this revision from [Analyzer] SValBuilder: Simlify a SymExpr to the absolute simplest form to [Analyzer][NFCi] SValBuilder: Simlify a SymExpr to the absolute simplest form.Dec 6 2021, 11:45 AM
martong edited the summary of this revision. (Show Details)
steakhal accepted this revision.Dec 6 2021, 11:56 AM

You mentioned in the summary that there are different places where simplification-like machinary kicks in, which hindered the test case synthesis. What places did you refer to exactly?

This revision is now accepted and ready to land.Dec 6 2021, 11:56 AM

You mentioned in the summary that there are different places where simplification-like machinary kicks in, which hindered the test case synthesis. What places did you refer to exactly?

These are the places where we call SimpleSValBuilder::simplifySVal.

  1. EquivalenceClass::simplify
  2. SimpleSValBuilder::evalBinOpNN
  3. SimpleSValBuilder::getKnownValue