[PATCH] D110529: [FuncSpec] Don't crash and specialise on poison or constexpr values

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 03:23:16 PDT 2021


SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: ChuanqiXu, snehasish, nikic.
Herald added subscribers: ormris, hiraditya.
SjoerdMeijer requested review of this revision.
Herald added a project: LLVM.

Function specialization was crashing at i) poison values and 2) constexpr values.

The problem is that these values are not added to the solver, so when a lookup is performed the crash happens. This fixes that by not specialising on these values. For poison that is obvious, but for constexpr this is a change in behaviour. Thus, in one way this is a bit of a stopgap, but specialising on constexpr values wasn't done very intentionally, and need some more work and tests if we wanted to support this, which is why not allowing constexprs seems fine to me.

This fixes: https://bugs.llvm.org/show_bug.cgi?id=51600


https://reviews.llvm.org/D110529

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110529.375188.patch
Type: text/x-patch
Size: 7121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210927/f07b68bd/attachment.bin>


More information about the llvm-commits mailing list