diff --git a/llvm/lib/TargetParser/PPCTargetParser.cpp b/llvm/lib/TargetParser/PPCTargetParser.cpp index f74d670df4306..106d07107ac8c 100644 --- a/llvm/lib/TargetParser/PPCTargetParser.cpp +++ b/llvm/lib/TargetParser/PPCTargetParser.cpp @@ -138,8 +138,11 @@ std::optional> getPPCDefaultTargetFeatures(const Triple &T, // The target feature `quadword-atomics` is only supported for 64-bit // POWER8 and above. - if (Features.find("quadword-atomics") != Features.end() && !T.isArch64Bit()) - Features["quadword-atomics"] = false; + if (!T.isArch64Bit()) { + auto It = Features.find("quadword-atomics"); + if (It != Features.end()) + It->second = false; + } return Features; } } // namespace PPC