Commit 7b65219
authored
[IR] Add ImplicitTrunc argument to ConstantInt::get() (#170865)
Add an ImplicitTrunc argument to ConstantInt::get(), which allows
controlling whether implicit truncation of the value is permitted.
This argument currently defaults to true, but will be switched to false
in the future to guard against signed/unsigned confusion, similar to
what has already happened for APInt.
The argument gives an opt-out for cases where the truncation is
intended. The patch contains one illustrative example where this
happens.1 parent 3d24efd commit 7b65219
File tree
3 files changed
+19
-11
lines changed- llvm
- include/llvm/IR
- lib
- IR
- Transforms/InstCombine
3 files changed
+19
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
| 125 | + | |
| 126 | + | |
123 | 127 | | |
124 | | - | |
| 128 | + | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
127 | | - | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
960 | 960 | | |
961 | 961 | | |
962 | 962 | | |
963 | | - | |
964 | | - | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
965 | 967 | | |
966 | 968 | | |
967 | 969 | | |
| |||
970 | 972 | | |
971 | 973 | | |
972 | 974 | | |
973 | | - | |
974 | | - | |
975 | | - | |
| 975 | + | |
| 976 | + | |
976 | 977 | | |
977 | | - | |
| 978 | + | |
978 | 979 | | |
979 | 980 | | |
980 | 981 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3811 | 3811 | | |
3812 | 3812 | | |
3813 | 3813 | | |
3814 | | - | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
3815 | 3817 | | |
3816 | 3818 | | |
3817 | 3819 | | |
| |||
0 commit comments