[all-commits] [llvm/llvm-project] 109541: [llvm][StringExtras] Add a fail-able version of `f...
River Riddle via All-commits
all-commits at lists.llvm.org
Wed Oct 28 17:04:05 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 1095419b10ff222c3cc362be27d97ff561a2181b
https://github.com/llvm/llvm-project/commit/1095419b10ff222c3cc362be27d97ff561a2181b
Author: River Riddle <riddleriver at gmail.com>
Date: 2020-10-28 (Wed, 28 Oct 2020)
Changed paths:
M llvm/include/llvm/ADT/StringExtras.h
M llvm/unittests/ADT/StringExtrasTest.cpp
Log Message:
-----------
[llvm][StringExtras] Add a fail-able version of `fromHex`
This revision adds a fail-able/checked version of `fromHex` that fails when the input string contains a non-hex character. This removes the need for users to have a separate check for if the string contains all hex digits. This becomes very costly for large hex strings given that checking if a string contains only hex digits is effectively the same as just converting it in the first place.
Context: In MLIR we use hex strings to represent very large constants in the textual format of the IR. These changes lead to a large decrease in compile time when parsing these constants (2 seconds -> 1 second).
Differential Revision: https://reviews.llvm.org/D90265
Commit: f6a6f27edb3991154393976e9e8f7b88542d406c
https://github.com/llvm/llvm-project/commit/f6a6f27edb3991154393976e9e8f7b88542d406c
Author: River Riddle <riddleriver at gmail.com>
Date: 2020-10-28 (Wed, 28 Oct 2020)
Changed paths:
M llvm/include/llvm/ADT/StringExtras.h
Log Message:
-----------
[llvm][StringExtras] Use a lookup table for `hexDigitValue`
This method is at the core of the conversion from hex to binary, and using a lookup table great improves the compile time of hex conversions.
Context: In MLIR we use hex strings to represent very large constants in the textual format of the IR. These changes lead to a large decrease in compile time when parsing these constants (>1 second -> 350 miliseconds).
Differential Revision: https://reviews.llvm.org/D90320
Commit: bf0440be91a6ea18fc8c1601f7ce6bcc8e6d2300
https://github.com/llvm/llvm-project/commit/bf0440be91a6ea18fc8c1601f7ce6bcc8e6d2300
Author: River Riddle <riddleriver at gmail.com>
Date: 2020-10-28 (Wed, 28 Oct 2020)
Changed paths:
M mlir/lib/Parser/AttributeParser.cpp
M mlir/lib/Parser/Token.cpp
M mlir/lib/Parser/Token.h
M mlir/test/IR/dense-elements-hex.mlir
M mlir/test/IR/invalid.mlir
Log Message:
-----------
[mlir] Optimize the parsing of ElementsAttr hex strings
This revision optimizes the parsing of hex strings by using the checked variant of llvm::fromHex, and adding a specialized method to Token for extracting hex strings. This leads a large decrease in compile time when parsing large hex constants (one example: 2.6 seconds -> 370 miliseconds)
Differential Revision: https://reviews.llvm.org/D90266
Compare: https://github.com/llvm/llvm-project/compare/49c84fd5a4bd...bf0440be91a6
More information about the All-commits
mailing list