-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ShapeAnalysisMgr #59254
Add ShapeAnalysisMgr #59254
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
class IR_API ShapeAnalysisManager { | ||
public: | ||
static ShapeAnalysisManager& Instance(); | ||
ShapeConstraintIRAnalysis& GetShapeConstraintIRAnalysis( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ShapeConstraintIRAnalysis& GetShapeConstraintIRAnalysis( | |
ShapeConstraintIRAnalysis& Get( |
Get是不是就可以了,简洁易用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好
|
||
private: | ||
ShapeAnalysisManager() {} | ||
std::unordered_map<pir::Program*, ShapeConstraintIRAnalysis> tables_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如之前沟通,在一些单测文件中,可能会包含很多个单测单元。在执行时,由于具有「时间连续性」,可能会出现A 测试单元的program 分配的地址是 0x123,执行完后回收资源;紧接着执行 B 测试单元,给新program分配的地址依旧是 0x123,导致此时从ShapeAnalysisManager查询得到的是A 中对应的 ShapeConstraintIRAnalysis,出现了「错位」,引发各种奇怪的错误
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
经过讨论,通过在 program 中 d module op 加 id 解决
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return instance; | ||
} | ||
|
||
ShapeConstraintIRAnalysis& ShapeAnalysisManager::Get(pir::Program* program) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参数用 const Progran&会不会更好一点? 不用担心指针为空的风险。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK,下一个PR可以修改一下
* ShapeAnalysisMgr * singleton * UT * Werror=reorder
PR types
Others
PR changes
Others
Description
Other
Pcard-67164