[all-commits] [llvm/llvm-project] 5921bc: [LLParser] Allow zero-input phi nodes

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Aug 31 05:24:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5921bc42718d3723ab2a4ba412288db51cc198b2
      https://github.com/llvm/llvm-project/commit/5921bc42718d3723ab2a4ba412288db51cc198b2
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M llvm/lib/AsmParser/LLParser.cpp
    A llvm/test/Assembler/zero-input-phi.ll
    M llvm/unittests/IR/BasicBlockTest.cpp

  Log Message:
  -----------
  [LLParser] Allow zero-input phi nodes

Zero-input phi nodes are accepted by the verifier and bitcode reader,
but currently rejected by the IR parser. Allow them there as well.

Because phi nodes must have one entry for each predecessor, such
phis can only occur in blocks without predecessors, aka unreachable
code.

Usually, when removing the last predecessor from a block, we also
remove phi nodes in it. However, this is not possible for
invalidation reasons sometimes, which is why we ended up allowing
zero-entry phis at some point in the past. See 9eb2c0113dfe,
D92247 and PR48296 for context.

I've dropped the verifier unit test, because this is now covered
by the regular IR test.

This fixes at least part of https://github.com/llvm/llvm-project/issues/57446.

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


  Commit: 9f6c09de448200de899d02895d339510fcfcd5ea
      https://github.com/llvm/llvm-project/commit/9f6c09de448200de899d02895d339510fcfcd5ea
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    A llvm/test/Assembler/phi-first-class-type.ll

  Log Message:
  -----------
  [LLParser] Add test for phi first class type error (NFC)


Compare: https://github.com/llvm/llvm-project/compare/12d865415ff3...9f6c09de4482


More information about the All-commits mailing list