This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Return from reAssume if State is posteriorly overconstrained
ClosedPublic

Authored by martong on May 25 2022, 12:30 PM.

Details

Summary

Depends on D124758. That patch introduced serious regression in the run-time in
some special cases. This fixes that.

Diff Detail

Event Timeline

martong created this revision.May 25 2022, 12:30 PM
martong requested review of this revision.May 25 2022, 12:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 12:30 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
martong added inline comments.May 25 2022, 12:41 PM
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
2553

I am wondering, that maybe it would be better to check for isPosteriorlyOverconstrained here. Because only State->assume can return such States, and by checking it here, we could spare some instructions.

Thanks for the quick response!

clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
137

This shouldnt be the way.
Consider fwd declaring and making it friend instead.
I really dont want to expose this api.

clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
2553

Play with it.

clang/test/Analysis/runtime-regression.c
8

Sadly, I had to manually track this down xD.

9

Maybe the test infra has something to specify a timeout.

13

Pin the tartget triple.

martong updated this revision to Diff 432225.May 26 2022, 2:49 AM
martong marked 5 inline comments as done.
  • Make reAssume friend, pin the target in the test
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
137

Okay, I've made it a friend.

clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
2553

Yeah, I will, but I don't know how much time that would take to assess. So, in the meantime let's proceed with this version.

clang/test/Analysis/runtime-regression.c
8

Ok, I removed the sentence.

9

I could not find how to set a timeout in the test file. There is a lit cli option that might be used, however, that would affect all other test cases. https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-timeout

13

Ok, done.

steakhal accepted this revision.May 26 2022, 3:49 AM

Typo; other than that LGTM

clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
118
clang/test/Analysis/runtime-regression.c
9

Why you could do is to call RUN {lit} --max-time XX Then do a FileCheck against the output of that.
Alternatively, we can craft something to make the situation worse, to the point that we will notice, and effectively hang the test suite. Either way, I'm fine with how things look ATM.

This revision is now accepted and ready to land.May 26 2022, 3:49 AM
This revision was landed with ongoing or failed builds.May 26 2022, 4:51 AM
This revision was automatically updated to reflect the committed changes.
martong marked an inline comment as done.
martong added inline comments.May 26 2022, 4:51 AM
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
118

Fixed, thx.