Fixes https://github.com/llvm/llvm-project/issues/58408
X % Y -> X when X < Y
Differential D138360
[CVP] Eliminate urem when LHS < RHS caojoshua on Nov 19 2022, 11:31 AM. Authored by
Details
Fixes https://github.com/llvm/llvm-project/issues/58408 X % Y -> X when X < Y
Diff Detail
Unit Tests Event TimelineComment Actions Most arithmetic optimizations that use ConstantRange data defer logic to We can do this in either SCCP or CVP. I don't think we can do this in InstCombine or InstSimplify because they don't have ConstantRange data. Comment Actions Change redundant ifs into asserts. Change constant range check to use CR1.icmp(icmp_ult, CR2).
Comment Actions Can I get help merging this? I'm not a committer. I have the patch in https://github.com/caojoshua/llvm-project/commit/cac29ca43207f316e2b0904bee45d778d903a76e |
Already checked in processUDivOrURem.