[PATCH] D88287: [NARY-REASSOCIATE] Support reassociation of min/max

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 10:24:43 PDT 2021


spatel added a subscriber: Hipony.
spatel added a comment.

cc @Hipony 
This patch causes an infinite loop with the following example from and "opt -nary-reassociate":

  define i32 @nary_infinite_loop_minmax(i32 %d0, i32 %d1, i32 %d2, i32 %d3) {
    %cmp0 = icmp slt i32 %d2, %d1
    %sel0 = select i1 %cmp0, i32 %d1, i32 %d2
  
    %cmp1 = icmp slt i32 %d3, %d0
    %sel1 = select i1 %cmp1, i32 %d0, i32 %d3
  
    %cmp2 = icmp slt i32 %sel1, %sel0
    %sel2 = select i1 %cmp2, i32 %sel1, i32 %sel0
  
    %cmp3 = icmp slt i32 %d3, %d0
    %sel3 = select i1 %cmp3, i32 %d0, i32 %d3
  
    %cmp4 = icmp slt i32 %sel3, %d2
    %sel4 = select i1 %cmp4, i32 %d2, i32 %sel3
  
    %cmp5 = icmp slt i32 %sel4, %d1
    %sel5 = select i1 %cmp5, i32 %d1, i32 %sel4
    ret i32 %sel5
  }

There was another infinite loop example attached to the commit message for this patch - https://reviews.llvm.org/rG83d134c3c4222e8b8d3d90c099f749a3b3abc8e0 
I'm not sure if that is the same root cause, but I don't think there was any reply to that failure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88287/new/

https://reviews.llvm.org/D88287



More information about the llvm-commits mailing list