https://llvm.org/bugs/show_bug.cgi?id=23200

            Bug ID: 23200
           Summary: AddDiscriminators and
                    DILocation::computeNewDiscriminator() modifies the
                    LLVMContext inappropriately
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified

`DILocation::computeNewDiscriminator()` modifies a table in the LLVMContext
indexed by filename/line.  This will changes results in other modules created
in the same context, and the table doesn't get serialized to bitcode/assembly
(so roundtripping will change the results of `computeNewDiscriminator()`).

Although it doesn't cause problems for `clang` in practice, this is fairly
broken.

Fortunately, the fix is simple: move the table (and logic) into
`AddDiscriminators::runOnFunction()` and stop modifying the LLVMContext.  This
table is discriminating between adjacent basic blocks, so it doesn't need
global state.

I'll add FIXMEs and tag this PR when I move the function over to MDLocation,
and hopefully circle back to fix it soon after (if no one beats me to it).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to