<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/71388>71388</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Is DataLayout::getAlignment for TargetExtType unreachable?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:ir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            jcranmer-intel
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pmatos
      </td>
    </tr>
</table>

<pre>
    It looks as though the switch case:

```
case Type::TargetExtTyID: {
    Type *LayoutTy = cast<TargetExtType>(Ty)->getLayoutType();
 return getAlignment(LayoutTy, abi_or_pref);
  }
```

in `DataLayout.cpp::getAlignment` is unreachable due to the initial assert:
`assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");`.

Type::isSized() has the following case which returns false for TargetExtTyID:
```
    if (getTypeID() != StructTyID && getTypeID() != ArrayTyID &&
        !isVectorTy() && getTypeID() != TargetExtTyID)
      return false;
```

Do we need to improve the check in isSized with for example:

```
if (getTypeID() == TargetExtTyID)
  return getLayoutType()->isSized();
```
?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVMGO4jgQ_ZriUmqU2E0IhxyYTiO1tLdBex05pkg8Y-zIrgzDfv3KSRjonmYXoSCiV8_13quyitG0jqiC1RcQ4rsOyp0oPBnHZEEIWNULNXDnQ9WfFPu4aPzhUr0xWu9_RFQRufND2yF3hPFsWHeoVSSQW8hqyK7PIpu_49-EwP2lH2Fyu1ehJX79xfvLWw1yi7D-MgERccQhiO1f6uIH3l8QZJ3OYJAvd5WJ7BVEub-A2DyBfG2JryU9gShBbEBeeQPxEBy2xFtrWncixyDKKx7EC6rGfPPhWx_o-K4SYV1_Kmp6GodQZLViNZEtdd9PKt-dVWRoIg4ukNKdaizhYSBkP_ponGGjLKoYKfDNyiKb3ySVSaKJX80_dJjEIYgCRIEgxItyznNSl7S_uaOfId6hQk6Gcqd4aiFOFHmKexJaZMt7Sbeg3p_XjekTHr21_mxcOyaP587objY44lHZmCABP6b8qYkpcHNEEOW1-fq3ujwF_5XDoEeKq94HwG0I6nKHu_GnD4jcxL9Jsw8p7nv_HvC9b19s7vnmaRq1_p6UT8ej9ngmdESHFLY59cH_pNFF3ZH-gcbhbDKeDXejcfRLnXr7Pyv1wDRZ_1fvty34uCl_TNdDWXK3OFTysJEbtaAqLzYbsV5lUi66qjk2jSrlip71Wh3WG5nrrCmyZiWzoypluTCVyITM86zIRapZllqsV7KRWjWr_Kg1PGd0UsYurf15WvrQLkyMA1XrXJblwqqGbJzvroRIIxrmaytU6c1TM7QRnjNrIscbCxu2VL1FvC3qn0v6cWp7ul_YJHwItuqY-5iKxQ7ErjXcDc1S-xOI3djS9PPUB_-dNIPYjQoiiN0o4t8AAAD__4C3pFk">