llvm-project/llvm/lib/CodeGen/MIRParser
Jessica Paquette b0d17d99dd [MIParser] Ensure getHexUint doesn't produce APInts with a bitwidth of 0
If getHexUint reads in a hex 0, it will create an APInt with a value of 0.
The number of active bits on this APInt is used to calculate the bitwidth of
Result. The number of active bits is defined as an APInt's bitwidth - its
number of leading 0s. Since this APInt is 0, its bitwidth and number of leading
0s are equal.

Thus, Result is constructed with a bitwidth of 0, triggering an APInt assert.

This commit fixes that by checking if the APInt is equal to 0, and setting the
bitwidth to 32 if it is. Otherwise, it sets the bitwidth using getActiveBits.

This caused issues when compiling MIR files with successor probabilities. In
the case that a successor is tagged with a probability of 0, this assert would
fire on debug builds.

https://reviews.llvm.org/D37401

llvm-svn: 312387
2017-09-01 22:17:14 +00:00
..
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
LLVMBuild.txt Attempt to fix the BUILD_SHARED_LIBS build after the DIExpression change 2017-08-23 20:39:35 +00:00
MILexer.cpp Parse and print DIExpressions inline to ease IR and MIR testing 2017-08-23 20:31:27 +00:00
MILexer.h Parse and print DIExpressions inline to ease IR and MIR testing 2017-08-23 20:31:27 +00:00
MIParser.cpp [MIParser] Ensure getHexUint doesn't produce APInts with a bitwidth of 0 2017-09-01 22:17:14 +00:00
MIParser.h [CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-06-06 22:22:41 +00:00
MIRParser.cpp [MIR] Print target-specific constant pools 2017-08-02 11:09:30 +00:00