Index: llvm/lib/CodeGen/TargetInstrInfo.cpp =================================================================== --- llvm/lib/CodeGen/TargetInstrInfo.cpp +++ llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -1411,6 +1411,8 @@ const Function &ParentFn = FirstCand.getMF()->getFunction(); if (ParentFn.hasFnAttribute("target-features")) F.addFnAttr(ParentFn.getFnAttribute("target-features")); + if (ParentFn.hasFnAttribute("target-cpu")) + F.addFnAttr(ParentFn.getFnAttribute("target-cpu")); // Set nounwind, so we don't generate eh_frame. if (llvm::all_of(Candidates, [](const outliner::Candidate &C) { Index: llvm/test/CodeGen/AArch64/machine-outliner.ll =================================================================== --- llvm/test/CodeGen/AArch64/machine-outliner.ll +++ llvm/test/CodeGen/AArch64/machine-outliner.ll @@ -11,6 +11,7 @@ ; TARGET_FEATURES-SAME: minsize ; TARGET_FEATURES-SAME: nounwind ; TARGET_FEATURES-SAME: optsize +; TARGET_FEATURES-SAME: "target-cpu"="cyclone" ; TARGET_FEATURES-SAME: "target-features"="+sse" define linkonce_odr void @fish() #0 {