[PATCH] D71164: [InstCombine] Fix infinite loop due to bitcast <-> phi transforms

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 14:39:36 PST 2020


nikic added a comment.

I was able to create a reproducer with `uselistorder`:

  @Q = internal unnamed_addr global double 1.000000e+00, align 8
   
  define double @test(i1 %c, i64* %p) {
  entry:
    br i1 %c, label %if, label %end 
  
  if:                           
    %load = load i64, i64* bitcast (double* @Q to i64*), align 8
    br label %end 
  
  end:                                           
    %phi = phi i64 [ 0, %entry ], [ %load, %if ]
    store i64 %phi, i64* %p, align 8
    %cast = bitcast i64 %phi to double
    ret double %cast 
  
    uselistorder i64 %phi, { 1, 0 }
  } 

This also demonstrates the currently suboptimal (but not incorrect) transform without this patch: https://llvm.godbolt.org/z/KVqP2P

As such, we can fix this issue independently first :)


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

https://reviews.llvm.org/D71164





More information about the llvm-commits mailing list