[all-commits] [llvm/llvm-project] 5010b5: Check type for forward reference definition

Renato Golin via All-commits all-commits at lists.llvm.org
Wed May 6 06:35:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5010b5b7e6cf0925465ecaa4111927ee9bcfac67
      https://github.com/llvm/llvm-project/commit/5010b5b7e6cf0925465ecaa4111927ee9bcfac67
  Author: Renato Golin <rengolin at microsoft.com>
  Date:   2020-05-06 (Wed, 06 May 2020)

  Changed paths:
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/IR/invalid.mlir

  Log Message:
  -----------
  Check type for forward reference definition

The types of forward references are checked that they match with other
uses, but they do not check they match with the definition.

    func @forward_reference_type_check() -> (i8) {
      br ^bb2

    ^bb1:
      return %1 : i8

    ^bb2:
      %1 = "bar"() : () -> (f32)
      br ^bb1
    }

Would be parsed and the use site of '%1' would be silently changed to
'f32'.

This commit adds a test for this case, and a check during parsing for
the types to match.

Patch by Matthew Parkinson <mattpark at microsoft.com>

Closes D79317.




More information about the All-commits mailing list