For constant BUILD_VECTORs the operands need to be legal types. This can mean that when the number of sign bits is calculated it may look that the entire constant and inefficiently produce less sign bits than it could. For example i8 vectors could use i32 elements, for which 0x000000ff would be incorrectly limited to 1 sign bit as the original value has 24 sign bits. This makes it look at the constant directly, truncated to the correct type for the element so that it can correctly return 8.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Makes sense - we could go further and use ComputeKnownBits on the element whenever there is implicit truncation and chose between it and the ComputeNumSignBits call - but this is probably good enough in most cases.