================
@@ -390,12 +393,31 @@ struct InstrumentationConfig {
return Obj;
}
+ /// Mapping to remember global strings passed to the runtime.
+ DenseMap<StringRef, Constant *> GlobalStringsMap;
+
+ /// Mapping from constants to globals with the constant as initializer.
+ DenseMap<Constant *, GlobalVariable *> ConstantGlobalsCache;
+
+ Constant *getGlobalString(StringRef S, InstrumentorIRBuilderTy &IIRB) {
+ Constant *&V = GlobalStringsMap[SS.save(S)];
+ if (!V) {
+ auto &M = *IIRB.IRB.GetInsertBlock()->getModule();
+ V = IIRB.IRB.CreateGlobalString(
+ S, getRTName() + ".str",
+ M.getDataLayout().getDefaultGlobalsAddressSpace(), &M);
+ if (V->getType() != IIRB.IRB.getPtrTy())
----------------
arsenm wrote:
Shouldn't assume you can cast this?
https://github.com/llvm/llvm-project/pull/195378
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits