trunc-weird-user.ll 961 B

123456789101112131415161718192021222324252627282930313233343536
  1. ; RUN: opt -S -codegenprepare -mtriple=arm64-apple-ios7.0 %s | FileCheck %s
  2. %foo = type { i8 }
  3. define %foo @test_merge(i32 %in) {
  4. ; CHECK-LABEL: @test_merge
  5. ; CodeGenPrepare was requesting the EVT for { i8 } to determine
  6. ; whether the insertvalue user of the trunc was legal. This
  7. ; asserted.
  8. ; CHECK: insertvalue %foo undef, i8 %byte, 0
  9. %lobit = lshr i32 %in, 31
  10. %byte = trunc i32 %lobit to i8
  11. %struct = insertvalue %foo undef, i8 %byte, 0
  12. ret %"foo" %struct
  13. }
  14. define i64* @test_merge_PR21548(i32 %a, i64* %p1, i64* %p2, i64* %p3) {
  15. ; CHECK-LABEL: @test_merge_PR21548
  16. %as = lshr i32 %a, 3
  17. %Tr = trunc i32 %as to i1
  18. br i1 %Tr, label %BB2, label %BB3
  19. BB2:
  20. ; Similarly to above:
  21. ; CodeGenPrepare was requesting the EVT for i8* to determine
  22. ; whether the select user of the trunc was legal. This asserted.
  23. ; CHECK: select i1 {{%.*}}, i64* %p1, i64* %p2
  24. %p = select i1 %Tr, i64* %p1, i64* %p2
  25. ret i64* %p
  26. BB3:
  27. ret i64* %p3
  28. }