[all-commits] [llvm/llvm-project] 2fc0d1: [FuncSpec] Avoid crashing when SwitchInst doesn't ...

Vincent Lee via All-commits all-commits at lists.llvm.org
Fri Jun 30 21:12:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fc0d17e8b3d62ea20d11a509a9005c564a29755
      https://github.com/llvm/llvm-project/commit/2fc0d17e8b3d62ea20d11a509a9005c564a29755
  Author: Vincent Lee <leevince at fb.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
    A llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression6.ll

  Log Message:
  -----------
  [FuncSpec] Avoid crashing when SwitchInst doesn't see ConstantInt

D150464 updated the cost model for function specialization. Unfortunately, this
also crashes when trying to build stage2 LLD with thinLTO and assertions. It looks
like the issue is caused by a mishandling of the Constant in a SwitchInst since the
Constant cannot always be assumed to safely casted to a ConstantInt. In the case
of the crash, Constant was a ConstantExpr which triggered the assertion.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D154159




More information about the All-commits mailing list