Issue 176471
Summary [SCCP] Incorrect range computation for experimental_get_vector_length
Labels new issue
Assignees topperc
Reporter topperc
    I believe this computation is incorrect

```
      ConstantRange Result( 
          APInt::getZero(BitWidth), 
          APIntOps::umin(Count.getUpper(), MaxLanes.getUpper()));
```

If the maximum inclusive value for Count or MaxLanes is the maximum value, then getUpper() is 0. This causes an empty range to be created. I believe the correct calculation is something like

```
      ConstantRange Result = ConstantRange::getNonEmpty( 
          APInt::getZero(BitWidth), 
          APIntOps::umin(Count.getUnsignedMax(), MaxLanes.getUnsignedMax()) + 1);
```

CC: @lukel97 @preames 


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to