diff options
author | David Sherwood <david.sherwood@arm.com> | 2021-09-24 13:31:38 +0100 |
---|---|---|
committer | David Sherwood <david.sherwood@arm.com> | 2021-09-24 13:37:23 +0100 |
commit | 8e4f7b749c2c03809f022c95698686c8584097fc (patch) | |
tree | c5e48dc71342d3889fab3154dd2b5f646e74752b /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 3593ae4312f6156c9ca50d46cdb55a8dfad782d0 (diff) | |
download | llvm-8e4f7b749c2c03809f022c95698686c8584097fc.zip llvm-8e4f7b749c2c03809f022c95698686c8584097fc.tar.gz llvm-8e4f7b749c2c03809f022c95698686c8584097fc.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index ab5c388..35178f8 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1685,7 +1685,7 @@ static void computeKnownBitsFromOperator(const Operator *I, Known.Zero.setBitsFrom(31); break; case Intrinsic::vscale: { - if (!II->getParent() || + if (!II->getParent() || !II->getFunction() || !II->getFunction()->hasFnAttribute(Attribute::VScaleRange)) break; |