[all-commits] [llvm/llvm-project] 96509b: [Matrix] Preserve signedness when extending matrix...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Aug 23 02:12:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 96509bb98fc0a7e929304a64362baaa2589d5a6b
      https://github.com/llvm/llvm-project/commit/96509bb98fc0a7e929304a64362baaa2589d5a6b
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2024-08-23 (Fri, 23 Aug 2024)

  Changed paths:
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/SemaCXX/matrix-index-operator-sign-conversion.cpp

  Log Message:
  -----------
  [Matrix] Preserve signedness when extending matrix index expression. (#103044)

As per [1] the indices for a matrix element access operator shall have
integral or unscoped enumeration types and be non-negative. At the
moment, the index expression is converted to SizeType irrespective of
the signedness of the index expression. This causes implicit sign
conversion warnings if any of the indices is signed.

As per the spec, using signed types as indices is allowed and should not
cause any warnings. If the index expression is signed, extend to
SignedSizeType to avoid the warning.

[1]
https://clang.llvm.org/docs/MatrixTypes.html#matrix-type-element-access-operator

PR: https://github.com/llvm/llvm-project/pull/103044



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list