<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144579>144579</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm] Triple string has inconsistency in the object format component when the value equals to the default
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
royitaqi
</td>
</tr>
</table>
<pre>
Read [this code](https://github.com/llvm/llvm-project/blob/e29bb9a038245320164c5890d1a75843e4a664ef/llvm/lib/TargetParser/Triple.cpp#L1622-L1636).
Repro steps:
1. Create a Triple: "arch-vendor-os-env".
2. Call `triple.SetObjectFormat()` to set it to the same format of `getDefaultFormat()`. The object format component would be added.
3. Call `triple.SetEnvironment()` to set the same environment. The object format component would be removed.
4. One can then repeat step 2 and 3 to add/remove the object format component while it has always been the same object format.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUU8tu6zYQ_RpqM7BAjt4LLXyvq1WAFGl-YCSOLRY0qZCUA_99ITlp-kR7V5KgOY8ZnEMxmotj7kX1TVSnjNY0-9AHfzeJ3kw2en3vX5g0iOpbmk2EyWsW1UlgO6e0RFEcBQ4Ch4tJ8zrmk78KHKy9fT4OS_C_8pQEDqP1o8CBsRvHjmTRYlkVKFVdTlXbSa2oqdqy4JLquuTzH3jMhnulcOH0M4XIYfsMZrGcT8sisHhSNeLhSdVFLbDLhTwKeXzhJXiIiR825VHl8D0wJQaCB1wURxCIFKb5cGOnfTj4eGB3E4gbC-bwnawFUcv00PuF0_O4LTT4cKUksBXYiVpC8hA5gUnbW5oZIl0ZzvsU-PNGceF04jOt9q_gHF5nBr_zfkImf128Y5fg3a9Ww8hAWrPebBX_ZOsndzPBuyu7v7v63Q9_Df1P0cBXf3vIljk8O4aJ3EboIPDClPYLAwI5DcUmSFoLHB64XflfNWZjebvYTBHIvtM9wsjsvuz-CblZyHRf6K7oKONeNZVUbakalc392DTTWDaqUk0tJyZFZ24arlWrZam0zkyPEitZq0a1qlYql_W56Ao9VuW5VgVWopR8JWPzLXW5D5fMxLhyr8qyarrM0sg27kVBdPwO-1-BuPUm9HvWx_USRSmtiSl-0SST7N6wPc7V6SN7EFMw7rIvb9zkXTQxsZvuYNx_nO3jRDeyKwO_rWTjZ-r0I2DZGmz_ww3dV4oCh4-dbz3-FgAA__8t8loq">