The CPU is used to determine which inline asm instructions are allowed, so
needs to be copied across in case the outlined function contains any.
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) {
; 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 {