PR21582.ll 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ; RUN: opt < %s -basicaa -licm -S | FileCheck %s
  2. @b = external global i32, align 4
  3. @fn3.i = external global i32, align 4
  4. declare i32 @g() nounwind
  5. define i32 @f() {
  6. entry:
  7. br label %for.cond
  8. for.cond: ; preds = %for.end, %entry
  9. ; CHECK-LABEL: for.cond:
  10. ; CHECK: store i32 0, i32* @b
  11. store i32 0, i32* @b, align 4
  12. br i1 true, label %for.body.preheader, label %for.end
  13. for.body.preheader: ; preds = %for.cond
  14. br label %for.body
  15. for.body: ; preds = %for.body, %for.body.preheader
  16. %g.15 = phi i32 [ undef, %for.body ], [ 0, %for.body.preheader ]
  17. %arrayidx2 = getelementptr inbounds i32, i32* @fn3.i, i64 0
  18. %0 = load i32, i32* %arrayidx2, align 4
  19. %call = call i32 @g()
  20. br i1 false, label %for.body, label %for.end.loopexit
  21. for.end.loopexit: ; preds = %for.body
  22. br label %for.end
  23. for.end: ; preds = %for.end.loopexit, %for.cond
  24. %whatever = phi i32 [ %call, %for.end.loopexit ], [ undef, %for.cond ]
  25. br i1 false, label %for.cond, label %if.then
  26. if.then: ; preds = %for.end
  27. ; CHECK-LABEL: if.then:
  28. ; CHECK: phi i32 [ {{.*}}, %for.end ]
  29. ; CHECK-NOT: store i32 0, i32* @b
  30. ; CHECK: ret i32
  31. ret i32 %whatever
  32. }