14 Commits

Author SHA1 Message Date
David Green
3b8adcfd92
[GlobalISel] Add computeNumSignBits for ASHR (#139503) 2025-07-21 10:23:26 +01:00
Tim Gymnich
5aed4800f3
[GISel] KnownFPClass ValueTracking fix handling of vectors (#143372) 2025-06-12 14:43:40 +02:00
Jason Eckhardt
bf53a49492
[GISel][NFC] Use ranged-for/enumerate in a few places. (#143185)
Follow-up to https://github.com/llvm/llvm-project/pull/143113.
2025-06-07 08:49:53 -05:00
Usha Gupta
d5a1f49827
[GISel] [NFC] Capitalize loop indices in GISelValueTracking.cpp for style consistency (#143113)
Following up on a comment on
https://github.com/llvm/llvm-project/pull/142355.
Updated other instances in the file as well.

@jayfoad
2025-06-06 23:14:50 +09:00
Usha Gupta
cf348e886d
[GlobalISel] Add G_CONCAT_VECTOR handling in computeNumSignBits (#142355)
Code ported from SelectionDAG::ComputeNumSignBits
2025-06-04 11:11:18 +01:00
Usha Gupta
7c996012ce
[GlobalISel] Add G_CONCAT_VECTOR computeKnownBits (#141933)
Code ported from SelectionDAG::computeKnownBits.
2025-05-30 10:44:59 +01:00
Tim Gymnich
760bf4f116
[GISel] Add KnownFPClass Analysis to GISelValueTrackingPass (#134611)
- add KnownFPClass analysis to GISelValueTrackingPass
- add MI pattern for `m_GIsFPClass`
2025-05-23 14:38:51 +02:00
David Green
77c8d21413
[GlobalISel] Fix ZExt known bits for scalable vectors. (#140213)
It was using the full size of the vector as the SrcBitWidth. This patch
changes the code to split G_ASSERT_ZEXT away from the others (G_INTTOPTR
/ G_PTRTOINT / G_ZEXT / G_TRUNC) which are simpler, and make the code
match the SDAG equivalent.
2025-05-21 19:52:19 +01:00
David Green
85a6bedf00
[GlobalISel] Add known bits and sign-bits handling for G_SPLAT_VECTOR (#140204)
This forwards the KnownBits / SignBits from the scalar operand through
to the vector elements. The value is implicitly truncated if it is
larger than the vector element size. The change in
GISelValueTracking::computeNumSignBits allows scalable sign-bits using a
single element demanded elts, and brings it in line with the code in
ValueTracking and SDAG (and GISelValueTracking::getKnownBits). That was
the main motivation for adding this opcode, to prevent scalable vector
asserts.
2025-05-20 12:42:20 +01:00
David Green
d644597f57
[GlobalISel] Add computeNumSignBits for G_SHUFFLE_VECTOR (#139505)
The code is similar to computeKnownBits and the code in
SelectionDAG::ComputeNumSignBits.
2025-05-20 08:25:48 +01:00
David Green
722385e87b
[GlobalISel] Add G_SHUFFLE_VECTOR computeKnownBits (#139501)
The code is taken from SelectionDAG::computeKnownBits.
2025-05-17 12:20:16 +01:00
David Green
ec406e8674
[GlobalISel] Add a GISelValueTracker printing pass (#139687)
This adds a GISelValueTrackingPrinterPass that can print the known bits
and sign bit of each def in a function. It is built on the new pass
manager and so adds a NPM GISelValueTrackingAnalysis, renaming the older
class to GISelValueTrackingAnalysisLegacy.

The first 2 functions from the AArch64GISelMITest are ported over to an
mir test to show it working. It also runs successfully on all files in
llvm/test/CodeGen/AArch64/GlobalISel/*.mir that are not invalid. It can
hopefully be used to test GlobalISel known bits analysis more directly
in common cases, without jumping through the hoops that the C++ tests
requires.
2025-05-14 11:05:04 +01:00
David Green
137aa573ca
[GlobalISel] Add computeNumSignBits for G_BUILD_VECTOR. (#139506)
The code is similar to SelectionDAG::ComputeNumSignBits, but does not
deal with truncating buildvectors.
2025-05-13 09:36:14 +01:00
Tim Gymnich
1d0005a69a
[GlobalISel][NFC] Rename GISelKnownBits to GISelValueTracking (#133466)
- rename `GISelKnownBits` to `GISelValueTracking` to analyze more than
just `KnownBits` in the future
2025-03-29 11:51:29 +01:00