Commit b1bbb99
committed
[IR] Fix Module::setModuleFlag for uniqued metadata
Module::setModuleFlag is supposed to change a single module. However,
when an MDNode has the same value in more than one module in the same
LLVMContext, such MDNode is shared (uniqued) across all of
them. Therefore `MDNode::replaceOperandWith` changes all modules that
share the same MDNode.
This used to cause problems for #86212, where a module is marked as
"upgraded" via a module flag. When this flag is shared across multiple
modules, all of them are marked, yet some may not have been processed
at all.
After the patch we now construct a new MDNode and replace the old one.1 parent dda30e1 commit b1bbb99
2 files changed
+37
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
| 407 | + | |
407 | 408 | | |
408 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
409 | 414 | | |
410 | 415 | | |
411 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
106 | 136 | | |
107 | 137 | | |
108 | 138 | | |
| |||
0 commit comments