[llvm-dev] Issue with [InstCombine] Canonicalize range test idiom [D113366]

Sankisa, Krishna (Chaitanya) via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 18 10:24:38 PST 2021


[AMD Official Use Only]

Hi,

https://reviews.llvm.org/D113366 and https://github.com/llvm/llvm-project/commit/1376301c87274bccf5565eb892173442782b1de3

The above change causes a soft hang for the below IR in InstCombine Transform.

define i32 @p0(i32 %CF_init) {
  %t0 = add i32 %CF_init, -3
  %t1 = icmp ugt i32 %t0, 1
  %t2 = select i1 %t1, i32 -3, i32 1
  ret i32 %t2
}

tryToReuseConstantFromSelectInComparison() from InstCombineSelect.cpp will replace select with inverse icmp and select. 1376301c8727 change when it sees a icmp ugt will replace with icmp ult. InstCombinerImpl::run() in InstructionCombining.cpp, will run these transforms in a loop and it never ends. This is causing soft hang.

icmp ugt is always transformed to icmp ult. Issue is with this transform. Commenting out the change fixes the soft hang issue.
Any suggestion on other ways of fixing this in InstructionCombining transform pass?


Regards,
Chaitanya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211218/c4e2049a/attachment.html>


More information about the llvm-dev mailing list