[all-commits] [llvm/llvm-project] e67164: [GC] Remove buggy untested optimization from state...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Mar 11 10:03:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e6716418442bf178774ea2ec1d34d3d6a5e06b88
      https://github.com/llvm/llvm-project/commit/e6716418442bf178774ea2ec1d34d3d6a5e06b88
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2020-03-11 (Wed, 11 Mar 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
    M llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
    A llvm/test/CodeGen/X86/statepoint-duplicates-export.ll

  Log Message:
  -----------
  [GC] Remove buggy untested optimization from statepoint lowering

A downstream test case (see included reduced test) revealed that we have a bug in how we handle duplicate relocations. If we have the same SDValue relocated twice, and that value happens to be a constant (such as null), we only export one of the two llvm::Values. Exporting on a per llvm::Value basis is required to allow lowering of gc.relocates in following basic blocks (e.g. invokes). Without it, we end up with a use of an undefined vreg and bad things happen.

Rather than fixing the optimization - which appears to be hard - I propose we simply remove it. There are no tests in tree that change with this code removed. If we find out later that this did matter for something, we can reimplement a variation of this in CodeGenPrepare to catch the easy cases without complicating the lowering code.

Thanks to Denis and Serguei who did all the hard work of figuring out what went wrong here. The patch is by far the easy part. :)

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




More information about the All-commits mailing list