Commit cfdac8a
Automerge: [InstCombine] Compute result directly on APInts
If the bitwidth is 2 and we add two 1s, the result may overflow.
This is fine in terms of correctness, but triggers the APInt ctor
assertion. Fix this by performing the calculation directly on APInts.
Fixes the issue reported in:
llvm/llvm-project#114539 (comment)File tree
2 files changed
+17
-4
lines changed- llvm
- lib/Transforms/InstCombine
- test/Transforms/InstCombine
2 files changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3091 | 3091 | | |
3092 | 3092 | | |
3093 | 3093 | | |
3094 | | - | |
| 3094 | + | |
3095 | 3095 | | |
3096 | | - | |
| 3096 | + | |
3097 | 3097 | | |
3098 | | - | |
3099 | | - | |
| 3098 | + | |
| 3099 | + | |
3100 | 3100 | | |
3101 | 3101 | | |
3102 | 3102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
82 | 95 | | |
83 | 96 | | |
84 | 97 | | |
| |||
0 commit comments