[PATCH] D33850: Inlining: Don't re-map simplified cloned instructions.

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 16:21:25 PDT 2017


davide added a comment.

This actually seem to happen, i.e. we hit this assertion. We have an end-to-end (i.e. C test) that reduces to:

  define void @patatino() {
  for.cond:
    br label %for.body
  
  for.body:
    %tobool = icmp eq i32 5, 0
    %sel = select i1 %tobool, i32 0, i32 2
    br i1 undef, label %cleanup1.thread, label %cleanup1
  
  cleanup1.thread:
    ret void
  
  cleanup1:
    %cleanup.dest2 = phi i32 [ %sel, %for.body ]
    %switch = icmp ult i32 %cleanup.dest2, 1
    ret void
  }
  
  define void @main() {
  entry:
    call void @patatino()
    ret void
  }

crashing with `opt -inline` as when we call `SimplifyInstruction`

  %switch = icmp ult i32 %cleanup.dest2, 1

simplifies to

  %tobool = icmp eq i32 5, 0

This simplification, if something, is a little peculiar, as I expected that to just be simplified to `false`.


Repository:
  rL LLVM

https://reviews.llvm.org/D33850





More information about the llvm-commits mailing list