Author: Simon Pilgrim Date: 2021-01-21T11:04:07Z New Revision: 86021d98d3f8b27f7956cee04f11505c2e836e81
URL: https://github.com/llvm/llvm-project/commit/86021d98d3f8b27f7956cee04f11505c2e836e81 DIFF: https://github.com/llvm/llvm-project/commit/86021d98d3f8b27f7956cee04f11505c2e836e81.diff LOG: [X86] Avoid a std::string copy by replacing auto with const auto&. NFC. Fixes msvc analyzer warning. Added: Modified: llvm/lib/Target/X86/X86ISelLowering.cpp Removed: ################################################################################ diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 7cd17f109935..c5cc23f6236e 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -2516,11 +2516,11 @@ Value *X86TargetLowering::getIRStackGuard(IRBuilder<> &IRB) const { if (Offset == (unsigned)-1) Offset = (Subtarget.is64Bit()) ? 0x28 : 0x14; - auto GuardReg = getTargetMachine().Options.StackProtectorGuardReg; - if (GuardReg == "fs") - AddressSpace = X86AS::FS; - else if (GuardReg == "gs") - AddressSpace = X86AS::GS; + const auto &GuardReg = getTargetMachine().Options.StackProtectorGuardReg; + if (GuardReg == "fs") + AddressSpace = X86AS::FS; + else if (GuardReg == "gs") + AddressSpace = X86AS::GS; return SegmentOffset(IRB, Offset, AddressSpace); } } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits