[llvm] [ConstantRange] Bail out early in unsignedMulMayOverflow for wide integer types (PR #192275)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 21:21:03 PDT 2026


Firebear518 wrote:

Update: After patching unsignedMulMayOverflow, the fuzzer immediately found additional timeout cases on the same i5754496 type — this time triggered
by shift-based patterns (shl/ashr exact) rather than multiplication:                                                                                 
                                                                
```C++
; timeout-1                                                                                                                                          
define i5754496 @bw_no_widening(i5754496 %arg) {              
  %shl1 = shl i5754496 %arg, 8                                                                                                                       
  %ashr = ashr exact i5754496 %shl1, 8                                                                                                               
  %C = icmp ule i5754496 %ashr, 1                                                                                                                    
  ...                                                                                                                                                
}   
```                                                                                                                                                 
   
```C++
; timeout-2                                                                                                                                          
define i5754496 @bw_no_widening(i5754496 %arg) {              
  %shl1 = shl i5754496 %arg, 8
  %ashr = ashr exact i5754496 %shl1, 8                                                                                                               
  %shl2 = shl i5754496 1, %ashr
  ...                                                                                                                                                
}         
```                                                    

Both still hang after 30s even with the umul_overflows fix applied. This confirms @aengelke's point — ConstantRange::shl, ConstantRange::ashr, or computeKnownBits for shifts likely have similar super-linear complexity for very wide types. 
Fixing these one by one is whack-a-mole; the PerformanceTips.rst documentation addition is probably the right long-term answer.

https://github.com/llvm/llvm-project/pull/192275


More information about the llvm-commits mailing list