[Assignment Tracking] Check getTypeSizeInBits result for scalable vector types
authorOCHyams <orlando.hyams@sony.com>
Fri, 28 Apr 2023 07:46:22 +0000 (08:46 +0100)
committerOCHyams <orlando.hyams@sony.com>
Fri, 28 Apr 2023 08:10:38 +0000 (09:10 +0100)
commit9391177cbcb0e5fb051f7a867683d7a0817f1648
treee989c9b038e1d78923ba66a3e61a421cd077bb73
parente416515115337648ae6e694db22fe4d8196e6155
[Assignment Tracking] Check getTypeSizeInBits result for scalable vector types

Without this patch, in `getAssignmentInfo` the result of `getTypeSizeInBits` is
cast to `uint64_t`, which a) is an operation that will eventually be
unsupported by the API according to the comments, and b) causes an assertion
failure if the type is a scalable vector. Don't cast the `TypeSize` to
`uint64_t` and check `isScalable` before getting the fixed size.

This can result in incorrect variable locations, see llvm.org/PR62346 (but is
better than crashing).

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D149137
llvm/lib/IR/DebugInfo.cpp
llvm/test/DebugInfo/assignment-tracking/AArch64/lit.local.cfg [new file with mode: 0644]
llvm/test/DebugInfo/assignment-tracking/AArch64/scalable-vectors.ll [new file with mode: 0644]