Uploaded image for project: 'Swift'
  1. Swift
  2. SR-13016

Investigate -emit-ir with -num-threads outputting interleaved content

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: None
    • Labels:
      None

      Description

      When working on this change https://github.com/apple/swift/pull/32352 the windows tests failed unexpectedly. We tracked this down to the output containing these lines:

      This valid one (that there should have been 2 of):

      @__llvm_coverage_mapping = internal constant { { i32, i32, i32, i32 }, [1 x <{ i64, i32, i64 }>], [104 x i8] } { { i32, i32, i32, i32 } { i32 1, i32 94, i32 10, i32 2 }, [1 x <{ i64, i32, i64 }>] [<{ i64, i32, i64 }> <{ i64 346071021529087246, i32 9, i64 0 }>], [104 x i8] c"\01\\S:\\jenkins\\workspace\\swift-PR-windows\\swift\\test\\Profiler/Inputs/coverage_num_threads2.swift\01\00\00\01\01\01\0E\00\10\00" }, section ".lcovmap$M", align 8
      

      And this invalid one where the `__ll` was cut off from the beginning:

      @vm_coverage_mapping = internal constant { { i32, i32, i32, i32 }, [1 x <{ i64, i32, i64 }>], [104 x i8] } { { i32, i32, i32, i32 } { i32 1, i32 94, i32 10, i32 2 }, [1 x <{ i64, i32, i64 }>] [<{ i64, i32, i64 }> <{ i64 -8320429751471283630, i32 9, i64 0 }>], [104 x i8] c"\01\\S:\\jenkins\\workspace\\swift-PR-windows\\swift\\test\\Profiler/Inputs/coverage_num_threads1.swift\01\00\00\01\01\01\0E\00\10\00" }, section ".lcovmap$M", align 8
      

      I found the missing `__ll` above in another line:

      @__ll; ModuleID = '<swift-imported-modules>'
      

      It seems like when using `-emit-ir` (and maybe other output methods) with `-num-threads` greater than 1, the output can become interleaved. I was never able to reproduce this on macOS, or my Windows VM, but it reproduced consistently on Windows CI.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            keith Keith Smiley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: