diff options
author | Sergei Barannikov <barannikov88@gmail.com> | 2025-04-29 22:33:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-29 22:33:40 +0300 |
commit | becd418626e1ebedde6d095f7bb020e554251b15 (patch) | |
tree | 4783c1fbc3fb6c6a93ef661dccf6c401153f67ba /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 705ceff7c1fc328151a6506a91773aac429ccee3 (diff) | |
download | llvm-becd418626e1ebedde6d095f7bb020e554251b15.zip llvm-becd418626e1ebedde6d095f7bb020e554251b15.tar.gz llvm-becd418626e1ebedde6d095f7bb020e554251b15.tar.bz2 |
[CGP] Despeculate ctlz/cttz with "illegal" integer types (#137197)
The code below the removed check looks generic enough to support
arbitrary integer widths. This change helps 32-bit targets avoid
expensive expansion/libcalls in the case of zero input.
Pull Request: https://github.com/llvm/llvm-project/pull/137197
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index e8dc775..f9dcb47 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -2552,9 +2552,9 @@ static bool despeculateCountZeros(IntrinsicInst *CountZeros, (IntrinsicID == Intrinsic::ctlz && TLI->isCheapToSpeculateCtlz(Ty))) return false; - // Only handle legal scalar cases. Anything else requires too much work. + // Only handle scalar cases. Anything else requires too much work. unsigned SizeInBits = Ty->getScalarSizeInBits(); - if (Ty->isVectorTy() || SizeInBits > DL->getLargestLegalIntTypeSizeInBits()) + if (Ty->isVectorTy()) return false; // Bail if the value is never zero. |