llvm.reloc.none takes a GlobalValue again
This avoids avoid modifying Module in ISel
This commit is contained in:
parent
b7f8a9c8b4
commit
9265309f0c
@ -4021,12 +4021,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
|
||||
DenseSet<StringRef> Aspects(llvm::from_range,
|
||||
ArrayRef<StringRef>(Args).drop_front(5));
|
||||
Module *M = CI->getModule();
|
||||
LLVMContext &Ctx = M->getContext();
|
||||
Function *Callee = CI->getCalledFunction();
|
||||
FunctionCallee ModularFn =
|
||||
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
|
||||
Callee->getAttributes().removeFnAttribute(
|
||||
Ctx, "modular-format"));
|
||||
M->getContext(), "modular-format"));
|
||||
CallInst *New = cast<CallInst>(CI->clone());
|
||||
New->setCalledFunction(ModularFn);
|
||||
New->removeFnAttr("modular-format");
|
||||
@ -4036,10 +4035,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
|
||||
SmallString<20> Name = ImplName;
|
||||
Name += '_';
|
||||
Name += Aspect;
|
||||
Constant *Sym =
|
||||
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
|
||||
Function *RelocNoneFn =
|
||||
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
|
||||
B.CreateCall(RelocNoneFn,
|
||||
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
|
||||
B.CreateCall(RelocNoneFn, {Sym});
|
||||
};
|
||||
|
||||
if (Aspects.contains("float")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user