[all-commits] [llvm/llvm-project] 2819c4: [APFloat][Perf] Improve FP literal parsing speed a...
Lewis Crawford via All-commits
all-commits at lists.llvm.org
Wed Sep 16 06:04:01 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2819c4e7933fa39599c527d5a07ca72b02da91e6
https://github.com/llvm/llvm-project/commit/2819c4e7933fa39599c527d5a07ca72b02da91e6
Author: Lewis Crawford <lcrawford at nvidia.com>
Date: 2026-09-16 (Wed, 16 Sep 2026)
Changed paths:
M llvm/lib/Support/APFloat.cpp
A llvm/lib/Support/APFloatPowerOfFiveTable.inc
M llvm/unittests/ADT/APFloatTest.cpp
A llvm/utils/generate-apfloat-pow5-table.py
Log Message:
-----------
[APFloat][Perf] Improve FP literal parsing speed and stack usage (#221701)
Rewrite APFloat decimal conversion to reduce stack use and speed up
floating-point literal parsing.
On an `llvm-as` test of 100k randomized half/float/double/fp128 global
constants, assembly time fell from 666 ms to 551 ms (17.3%) and peak
stack use fell from 25,912 B to 6,640 B (74.4%).
To achieve these results, there are several optimizations:
- Precomputing the powers-of-five factors, replacing a 1,205-word
runtime workspace with a 601-word constant table sufficient to construct
powers through 5^16383.
- Replacing the two fixed 600-word stack-based scratch/destination
buffers with SmallVectors that are dynamically sized based on the input,
drastically reducing stack usage.
- These SmallVectors allow for 16 64-bit words to be stored on the stack
(enough to cover ordinary f16/f32 inputs, which only need 2-6 words),
and larger doubles and fp128s get allocated on the heap instead.
Assisted-by: gpt-5.6-terra
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list