[llvm] [GlobalISel][KnownBits] Simplify G_CONSTANT handling (PR #91946)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 04:40:01 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-globalisel
Author: Pierre van Houtryve (Pierre-vh)
<details>
<summary>Changes</summary>
We called getIConstantVRegVal which again queried MRI to get the VReg def. We already have the def, so just get the CImm directly. It can't fail.
---
Full diff: https://github.com/llvm/llvm-project/pull/91946.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp (+1-4)
``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
index c8199a42d15c3..32d607cfd71a7 100644
--- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
@@ -256,10 +256,7 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
break;
}
case TargetOpcode::G_CONSTANT: {
- auto CstVal = getIConstantVRegVal(R, MRI);
- if (!CstVal)
- break;
- Known = KnownBits::makeConstant(*CstVal);
+ Known = KnownBits::makeConstant(MI.getOperand(1).getCImm()->getValue());
break;
}
case TargetOpcode::G_FRAME_INDEX: {
``````````
</details>
https://github.com/llvm/llvm-project/pull/91946
More information about the llvm-commits
mailing list