[all-commits] [llvm/llvm-project] 7c937d: [CodeGen] Forbid passing a PointerType to MVT::get...

Jessica Clarke via All-commits all-commits at lists.llvm.org
Wed May 22 15:57:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c937df05b7c636287e6058bb2e700618ff57c2f
      https://github.com/llvm/llvm-project/commit/7c937df05b7c636287e6058bb2e700618ff57c2f
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
    M llvm/include/llvm/CodeGen/ValueTypes.h
    M llvm/include/llvm/CodeGen/ValueTypes.td
    M llvm/include/llvm/CodeGenTypes/MachineValueType.h
    M llvm/lib/CodeGen/ValueTypes.cpp

  Log Message:
  -----------
  [CodeGen] Forbid passing a PointerType to MVT::getVT and EVT::getEVT (#92671)

There is the expectation throughout CodeGen that, for types representing
"real" values, the MVT or EVT is self-contained. However, MVT::iPTR is
challenging, because it has no address space, and even if it did, there
often is no DataLayout immediately accessible to determine what actually
is the underlying type.

Historically it was documented as being TableGen-only, but that was lost
in 631bfdbee5b45eda9f99dff6a716d63c5698e4bd's conversion to using the
generated defines. Let's preserve that intent by not allowing it to
originate through accidental calls to get(E)VT with a PointerType. If
you need to support that, be sure to use something like TargetLowering's
getValueType, which takes a DataLayout and can map pointers to their
concrete MVTs. Whilst here, reintroduce documentation about these value
types being TableGen-only.



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