aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp26
1 files changed, 3 insertions, 23 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 7734c0a8de58..c9748e1387eb 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -353,12 +353,11 @@ void llvm::printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name) {
// Scan the name to see if it needs quotes first.
bool NeedsQuotes = isdigit(static_cast<unsigned char>(Name[0]));
if (!NeedsQuotes) {
- for (unsigned i = 0, e = Name.size(); i != e; ++i) {
+ for (unsigned char C : Name) {
// By making this unsigned, the value passed in to isalnum will always be
// in the range 0-255. This is important when building with MSVC because
// its implementation will assert. This situation can arise when dealing
// with UTF-8 multibyte characters.
- unsigned char C = Name[i];
if (!isalnum(static_cast<unsigned char>(C)) && C != '-' && C != '.' &&
C != '_') {
NeedsQuotes = true;
@@ -1309,27 +1308,8 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Metadata *MD,
bool FromValue = false);
static void WriteOptimizationInfo(raw_ostream &Out, const User *U) {
- if (const FPMathOperator *FPO = dyn_cast<const FPMathOperator>(U)) {
- // 'Fast' is an abbreviation for all fast-math-flags.
- if (FPO->isFast())
- Out << " fast";
- else {
- if (FPO->hasAllowReassoc())
- Out << " reassoc";
- if (FPO->hasNoNaNs())
- Out << " nnan";
- if (FPO->hasNoInfs())
- Out << " ninf";
- if (FPO->hasNoSignedZeros())
- Out << " nsz";
- if (FPO->hasAllowReciprocal())
- Out << " arcp";
- if (FPO->hasAllowContract())
- Out << " contract";
- if (FPO->hasApproxFunc())
- Out << " afn";
- }
- }
+ if (const FPMathOperator *FPO = dyn_cast<const FPMathOperator>(U))
+ Out << FPO->getFastMathFlags();
if (const OverflowingBinaryOperator *OBO =
dyn_cast<OverflowingBinaryOperator>(U)) {