user-with-multiple-uses.ll 752 B

12345678910111213141516171819202122232425262728293031323334
  1. ; RUN: opt < %s -S -ipsccp | FileCheck %s
  2. ; PR5596
  3. ; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate
  4. ; the result.
  5. ; CHECK: define i32 @main() #0 {
  6. ; CHECK-NEXT: entry:
  7. ; CHECK-NEXT: %call2 = tail call i32 @wwrite(i64 0) [[NUW:#[0-9]+]]
  8. ; CHECK-NEXT: ret i32 123
  9. define i32 @main() noreturn nounwind {
  10. entry:
  11. %call2 = tail call i32 @wwrite(i64 0) nounwind
  12. ret i32 %call2
  13. }
  14. define internal i32 @wwrite(i64 %i) nounwind readnone {
  15. entry:
  16. switch i64 %i, label %sw.default [
  17. i64 3, label %return
  18. i64 10, label %return
  19. ]
  20. sw.default:
  21. ret i32 123
  22. return:
  23. ret i32 0
  24. }
  25. ; CHECK: attributes #0 = { noreturn nounwind }
  26. ; CHECK: attributes #1 = { nounwind readnone }
  27. ; CHECK: attributes [[NUW]] = { nounwind }