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.
28 lines
873 B
YAML
28 lines
873 B
YAML
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
|
# RUN: llc -mtriple aarch64 -passes="print<gisel-value-tracking>" %s -o - 2>&1 | FileCheck %s
|
|
|
|
---
|
|
name: Cst
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.1:
|
|
; CHECK-LABEL: name: @Cst
|
|
; CHECK-NEXT: %0:_ KnownBits:00000001 SignBits:7
|
|
; CHECK-NEXT: %1:_ KnownBits:00000001 SignBits:7
|
|
%0:_(s8) = G_CONSTANT i8 1
|
|
%1:_(s8) = COPY %0
|
|
...
|
|
---
|
|
name: CstWithClass
|
|
# We can't analyze %0 due to the lack of an LLT. We will get a default
|
|
# constructed KnownBits back. %0 will have the correct size but we will
|
|
# not know any further info.
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.1:
|
|
; CHECK-LABEL: name: @CstWithClass
|
|
; CHECK-NEXT: %1:_ KnownBits:???????????????????????????????? SignBits:1
|
|
%0:gpr32 = MOVi32imm 1
|
|
%1:_(s32) = COPY %0
|
|
...
|