escape-phi-call.ll 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
  2. ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
  3. @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
  4. ; Addr-of in phi instruction
  5. ; Requires protector.
  6. define void @foo() nounwind uwtable safestack {
  7. entry:
  8. ; CHECK: __safestack_unsafe_stack_ptr
  9. %x = alloca double, align 8
  10. %call = call double @testi_aux() nounwind
  11. store double %call, double* %x, align 8
  12. %cmp = fcmp ogt double %call, 3.140000e+00
  13. br i1 %cmp, label %if.then, label %if.else
  14. if.then: ; preds = %entry
  15. %call1 = call double @testi_aux() nounwind
  16. store double %call1, double* %x, align 8
  17. br label %if.end4
  18. if.else: ; preds = %entry
  19. %cmp2 = fcmp ogt double %call, 1.000000e+00
  20. br i1 %cmp2, label %if.then3, label %if.end4
  21. if.then3: ; preds = %if.else
  22. br label %if.end4
  23. if.end4: ; preds = %if.else, %if.then3, %if.then
  24. %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
  25. %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
  26. ret void
  27. }
  28. declare double @testi_aux()
  29. declare i32 @printf(i8*, ...)