[PATCH] D54021: [LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 22 04:28:48 PST 2018


dmgreen added a comment.

Hello, Another one for you, this time to do with LCSSA not being preserved, run with "opt -loop-simplifycfg -indvars simplified.ll -S":

  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
  target triple = "aarch64-arm-none-eabi"
  
  define void @c() {
  entry:
    br label %d
  
  d.loopexit:                                       ; preds = %if.end.7, %for.body
    %.lcssa = phi i32 [ %1, %for.body ], [ 0, %if.end.7 ]
    br label %d
  
  d:                                                ; preds = %d.loopexit, %entry
    %0 = phi i32 [ undef, %entry ], [ %.lcssa, %d.loopexit ]
    br label %for.cond
  
  for.cond:                                         ; preds = %if.end.8, %d
    %1 = phi i32 [ %0, %d ], [ 0, %if.end.8 ]
    br label %for.body
  
  for.body:                                         ; preds = %for.cond
    %tobool2 = icmp eq i32 %1, 0
    br i1 %tobool2, label %if.end, label %d.loopexit
  
  if.end:                                           ; preds = %for.body
    br label %if.end.7
  
  if.end.7:                                         ; preds = %if.end
    br i1 true, label %if.end.8, label %d.loopexit
  
  if.end.8:                                         ; preds = %if.end.7
    br label %for.cond
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D54021





More information about the llvm-commits mailing list