[llvm] [GlobalIsel] Do not run getKnownBits if it is an exact udiv (NFC) (PR #99560)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 13:30:52 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-globalisel
Author: AtariDreams (AtariDreams)
<details>
<summary>Changes</summary>
This should be better for compile times.
---
Full diff: https://github.com/llvm/llvm-project/pull/99560.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp (+3-1)
``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index dfc3d73e322b8..a510f40decb84 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -5180,7 +5180,9 @@ MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
LLT ScalarShiftAmtTy = ShiftAmtTy.getScalarType();
unsigned KnownLeadingZeros =
- KB ? KB->getKnownBits(LHS).countMinLeadingZeros() : 0;
+ (!MI.getFlag(MachineInstr::MIFlag::IsExact) && KB)
+ ? KB->getKnownBits(LHS).countMinLeadingZeros()
+ : 0;
auto &MIB = Builder;
bool UseSRL = false;
``````````
</details>
https://github.com/llvm/llvm-project/pull/99560
More information about the llvm-commits
mailing list