[llvm] 4ff45ee - [GlobalISel][KnownBits] Simplify G_CONSTANT handling (#91946)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 04:59:29 PDT 2024
Author: Pierre van Houtryve
Date: 2024-05-13T13:59:24+02:00
New Revision: 4ff45eee36f003cda18a3654df4086e69dc245b5
URL: https://github.com/llvm/llvm-project/commit/4ff45eee36f003cda18a3654df4086e69dc245b5
DIFF: https://github.com/llvm/llvm-project/commit/4ff45eee36f003cda18a3654df4086e69dc245b5.diff
LOG: [GlobalISel][KnownBits] Simplify G_CONSTANT handling (#91946)
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.
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Removed:
################################################################################
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: {
More information about the llvm-commits
mailing list