For generic intrinsics, Intrinsic::getDeclaration expects a uniqueCurrently unnamed types cause problems for overloaded intrinsics like
declaration for each unique set of parameter types. This meansssa_copy, for eachbecause different unnamed types get mangled to the same
set of unique parameter types, we need a unique mangled namestring.
Currently this is not the case, as unnamed types do not have a nameThis patch introduces an additional map to LLVMContextImpl, sowhich keeps
different unnamed types will gettrack of IDs to use when mangled to the same nameing for unnamed types. This causes aThe IDs are
crash when using PredicateInfo with the test case attached.
This patch introduces an additional map to LLVMContextImpl,assigned at type creation time. For textual IR, those types are created
by order of appearance in the LL file. which keepsThis change also changes the
bitcode writer to write unnamed types in the order they were created,
track of IDs to use when mangling for unnamedbefore other types. It is populated onThis ensures IDs are assigned in the same fashion in
demand when mangling. I am not sure if this is the best approach, but itboth cases.
seems to do the job.