[llvm] [GlobalISel] Correct comment about type vs register class (PR #116083)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 09:41:45 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-globalisel
Author: Daniel Sanders (dsandersllvm)
<details>
<summary>Changes</summary>
Type and register class aren't mutually exclusive in gMIR but target
instructions don't have types on their operands that have register classes.
---
Full diff: https://github.com/llvm/llvm-project/pull/116083.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp (+10-9)
``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
index fefa8f2ea85942..179ac9deb3d4a5 100644
--- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
@@ -147,6 +147,16 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
unsigned Opcode = MI.getOpcode();
LLT DstTy = MRI.getType(R);
+ // Handle the case where this is called on a register that does not have a
+ // type constraint (i.e. it's a target instruction with a register class
+ // constraint instead). This is unlikely to occur except by looking through
+ // copies but it is possible for the initial register being queried to be in
+ // this state.
+ if (!DstTy.isValid()) {
+ Known = KnownBits();
+ return;
+ }
+
#ifndef NDEBUG
if (DstTy.isFixedVector()) {
assert(
@@ -158,15 +168,6 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
}
#endif
- // Handle the case where this is called on a register that does not have a
- // type constraint (i.e. it has a register class constraint instead). This is
- // unlikely to occur except by looking through copies but it is possible for
- // the initial register being queried to be in this state.
- if (!DstTy.isValid()) {
- Known = KnownBits();
- return;
- }
-
unsigned BitWidth = DstTy.getScalarSizeInBits();
auto CacheEntry = ComputeKnownBitsCache.find(R);
if (CacheEntry != ComputeKnownBitsCache.end()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/116083
More information about the llvm-commits
mailing list