[llvm] [DA] Widening SCEV expressions in strong SIV test to prevent overflow (PR #164704)
    Ehsan Amiri via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Oct 23 11:49:42 PDT 2025
    
    
  
amehsan wrote:
> I'm not entirely sure why wider type is useful even though we don't know the bounds of symbolic values
Consider this code:
```
const SCEV *Product = SE->getMulExpr(UpperBound, AbsCoeff)
```
if `UpperBound` is a symbolic 64 bit value and you multiply it with something, most likely you cannot prove the result doesn't overflow and you have to give up and return unknown dependence, because you cannot do a correct comparison in the next step. 
but if we extend both values to 128 bit and multiply them, the result will definitely not overflow 128 bits. So in the next step 
```
isKnownPredicate(CmpInst::ICMP_SGT, AbsDelta, Product)
```
Assuming `AbsDelata` is also extended to 128 bit you can perform a correct comparison. 
https://github.com/llvm/llvm-project/pull/164704
    
    
More information about the llvm-commits
mailing list