<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Artur,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 14, 2016, at 1:55 AM, Adam Nemet <<a href="mailto:anemet@apple.com" class="">anemet@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi again,<div class=""><br class=""></div><div class="">I reverted this in r266282 because the auto-upgrade part does not work well with LTO.</div><div class=""><br class=""></div><div class="">With LTO when you read a second instance of a type definition in a different module its name will be made unique by appending a unique index.  To trigger an auto-upgrade you simply re-mangle the name of the intrinsic and check if that is different from the intrinsic name used in the call.</div><div class=""><br class=""></div><div class="">This could be different if LTO required a new unique name.</div><div class=""><br class=""></div><div class="">The part I haven’t fully figured out yet is when the type is turned back to the original type (some sort of uniquing).</div></div></div></blockquote><div><br class=""></div><div>This is done in during linking when isomorphic types are mapped to the same type. </div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">  One thing is sure, when the LTOCodeGenerator verifies the merged module, the argument types and the intrinsic name are inconsistent again.  This part needs more analysis.</div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I will prepare a minimized testcase for you tomorrow.</div></div></div></blockquote><div><br class=""></div><div>This should do it:</div><div><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><div><div>$ llvm-as b.ll</div></div></div><div><div><div>$ llvm-as r.ll</div></div></div><div><div><div>$ llvm-lto b.bc r.bc</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.store.v4p0struct.rtx_def.p0v4p0struct.rtx_def</div></div></div><div><div><div>void (<4 x %struct.rtx_def*>, <4 x %struct.rtx_def*>*, i32, <4 x i1>)* @llvm.masked.store.v4p0struct.rtx_def.1.p0v4p0struct.rtx_def.1</div></div></div><div><div><div>LLVM ERROR: Broken module found, compilation aborted!</div></div></div></blockquote><div><br class=""></div><div>Let me know if something does not work.  Please also keep me CC’ed on future work; I am interested now ;)</div><div><br class=""></div><div>Adam</div><div><br class=""></div><div></div></div></body></html>