llvm-project
a83c8949 - Reapply [ConstantInt] Disable implicit truncation in ConstantInt::get() (#171456)

Commit
13 days ago
Reapply [ConstantInt] Disable implicit truncation in ConstantInt::get() (#171456) Reapply after additional fixes. ----- Disable implicit truncation in the ConstantInt constructor by default. This means that it needs to be passed a signed/unsigned (depending on the IsSigned flag) value matching the bit width. The intention is to prevent the recurring bug where people write something like `ConstantInt::get(Ty, -1)`, and this "works" until `Ty` is larger than 64-bit and then the value is incorrect due to missing type extension. This is the continuation of https://github.com/llvm/llvm-project/pull/112670, which originally allowed implicit truncation in this constructor to reduce initial scope of the change.
Author
Committer
Parents
Loading