[PATCH] D52827: [LICM] Make LICM able to hoist phis

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 11 21:41:23 PST 2018


mkazantsev added a comment.

The patch fails the following test:

`opt -licm -S test.ll`

  ; ModuleID = './bugpoint-reduced-simplified.ll'
  source_filename = "./bugpoint-reduced-simplified.ll"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
  
  define void @bar() {
  bb:
    %tmp = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> undef)
    br label %bb3
  
  bb1:                                              ; preds = %bb4
    %tmp2 = phi i32 [ %tmp5, %bb4 ]
    ret void
  
  bb3:                                              ; preds = %bb4, %bb
    br i1 undef, label %bb6, label %bb4
  
  bb4:                                              ; preds = %bb6, %bb6, %bb3
    %tmp5 = phi i32 [ %tmp, %bb3 ], [ undef, %bb6 ], [ undef, %bb6 ]
    br i1 undef, label %bb1, label %bb3
  
  bb6:                                              ; preds = %bb3
    br i1 undef, label %bb4, label %bb4
  }
  
  ; Function Attrs: nounwind readnone
  declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>) #0
  
  attributes #0 = { nounwind readnone }

The failure looks like

  PHINode should have one entry for each predecessor of its parent basic block!
    %tmp5 = phi i32 [ %tmp, %bb ], [ undef, %bb6.licm ], [ undef, %bb6.licm ]
  in function bar
  LLVM ERROR: Broken function found, compilation aborted!

Likely some corner case related to conditional branch to the same block for `true` and `false` is not handled. Please make sure that it passes before we can proceed with the patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D52827





More information about the llvm-commits mailing list