[mlir] Optimize the parsing of ElementsAttr hex strings
authorRiver Riddle <riddleriver@gmail.com>
Wed, 28 Oct 2020 23:46:38 +0000 (16:46 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Wed, 28 Oct 2020 23:58:06 +0000 (16:58 -0700)
commitbf0440be91a6ea18fc8c1601f7ce6bcc8e6d2300
treebddbbcb9a698ff81f59c25470a09c4fa1eeb945d
parentf6a6f27edb3991154393976e9e8f7b88542d406c
[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
mlir/lib/Parser/AttributeParser.cpp
mlir/lib/Parser/Token.cpp
mlir/lib/Parser/Token.h
mlir/test/IR/dense-elements-hex.mlir
mlir/test/IR/invalid.mlir