[Analysis] Fix issues when querying vscale attributes on functions
authorDavid Sherwood <david.sherwood@arm.com>
Tue, 21 Sep 2021 11:11:04 +0000 (12:11 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Fri, 24 Sep 2021 08:58:10 +0000 (09:58 +0100)
commitc2634fc6abe73acf0d9c4421071948e43d96d7eb
tree2d78cfa450b294803f69fd19dc919e3426c54246
parent3bad9616aa52aa467e4f1fb5c00abac6acba8471
[Analysis] Fix issues when querying vscale attributes on functions

There are several places in the code that are currently broken as
they assume an Instruction always has a parent Function when
attempting to get the vscale_range attribute. This patch adds checks
that an Instruction has a parent.

I've added a test for a parentless @llvm.vscale intrinsic call here:

  unittests/Analysis/ValueTrackingTest.cpp

Differential Revision: https://reviews.llvm.org/D110158
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/unittests/Analysis/ValueTrackingTest.cpp