When i1 true is used as an index, SExt extends it to i32 -1. This would cause BitVector to overflow.
This can be a quick fix by using ZExt over SExt, as we have specified in the language manual that the index shall be treated as an unsigned number. (https://llvm.org/docs/LangRef.html#insertelement-instruction)
## Reproduction
https://godbolt.org/z/P97TT7fEs
## Cause
When `i1 true` is used as an index, SExt extends it to `i32 -1`. This would cause BitVector to overflow.
This can be a quick fix by using ZExt over SExt, as we have specified in the language manual that the index shall be treated as an unsigned number. (https://llvm.org/docs/LangRef.html#insertelement-instruction)
Reproduction
https://godbolt.org/z/P97TT7fEs
Cause
When
i1 true
is used as an index, SExt extends it toi32 -1
. This would cause BitVector to overflow. This can be a quick fix by using ZExt over SExt, as we have specified in the language manual that the index shall be treated as an unsigned number. (https://llvm.org/docs/LangRef.html#insertelement-instruction)