This is an archive of the discontinued LLVM Phabricator instance.

[WIP][SCCP] Don't track specialized functions unless they are recursive.
AbandonedPublic

Authored by labrinea on Jun 29 2022, 7:42 AM.

Details

Reviewers
None
Summary

An attempt to fix a crash when compiling MultiSource from the llvm test suite with FuncSpecializationMaxIters > 1

llvm/include/llvm/Analysis/ValueLattice.h:
bool llvm::ValueLatticeElement::markConstant(llvm::Constant*, bool):
Assertion `getConstant() == V && "Marking constant with different value"'

llvm::ValueLatticeElement::markConstant(llvm::Constant*, bool)
llvm::SCCPInstVisitor::markConstant(llvm::Value*, llvm::Constant*)
llvm::SCCPInstVisitor::visitCastInst(llvm::CastInst&)
llvm::SCCPInstVisitor::solve()
llvm::FunctionSpecializer::specialize(llvm::SmallVectorImpl<llvm::Function*>&)

Diff Detail

Event Timeline

labrinea created this revision.Jun 29 2022, 7:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 7:42 AM
labrinea requested review of this revision.Jun 29 2022, 7:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 7:42 AM
labrinea planned changes to this revision.Jun 29 2022, 7:42 AM

Side note: I've fixed this in https://reviews.llvm.org/D126456 but there are more instances of the same issue (use after free) arising from marking a newly cloned function executable and then invoking the solver, which is something we only need for specializing recursive functions.

labrinea abandoned this revision.Dec 5 2022, 5:15 AM

Abandoning in favor of D126455.