[Analysis] Fix another issue when querying vscale attributes on functions
authorDavid Sherwood <david.sherwood@arm.com>
Fri, 24 Sep 2021 12:31:38 +0000 (13:31 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Fri, 24 Sep 2021 12:37:23 +0000 (13:37 +0100)
commit8e4f7b749c2c03809f022c95698686c8584097fc
treec5e48dc71342d3889fab3154dd2b5f646e74752b
parent3593ae4312f6156c9ca50d46cdb55a8dfad782d0
[Analysis] Fix another issue when querying vscale attributes on functions

There are several places in the code that are currently broken where
we assume an Instruction is always a member of a BasicBlock that
lives in a Function. This is a problem specifically when
attempting to get the vscale_range attribute. This patch adds checks
that an Instruction's parent also has a parent!

I've added a test for a function-less @llvm.vscale intrinsic call here:

  unittests/Analysis/ValueTrackingTest.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/unittests/Analysis/ValueTrackingTest.cpp