[PATCH] D126355: [FuncSpec]Fix assertion failure when lattice value is not found.

Sinan Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 00:52:06 PDT 2022


sinan created this revision.
sinan added reviewers: SjoerdMeijer, ChuanqiXu.
sinan added a project: LLVM.
Herald added subscribers: snehasish, ormris, hiraditya.
Herald added a project: All.
sinan requested review of this revision.
Herald added a subscriber: llvm-commits.

The patch from D110529 <https://reviews.llvm.org/D110529> partially solves the problem of bug51600 <https://bugs.llvm.org/show_bug.cgi?id=51600> . However, the reason for crashing is that if an argument is byval, and if the function is not readonly,  'ValueState' will not record the argument(SCCPInstVisitor::handleCallArguments), and thus we cannot find its value state in 'getPossibleConstants', and this leads to an assertation failure or crash.

The problem still exists in the current codebase, and this patch can solve it and also relax the constraint on constant expression. The attached test cases *-expression4.ll and *-expression5.ll can bypass the check of global variable and constant expression and trigger assertation failure.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126355

Files:
  llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression4.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression5.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126355.431893.patch
Type: text/x-patch
Size: 5989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220525/31727b79/attachment.bin>


More information about the llvm-commits mailing list