kitaisreal updated this revision to Diff 546381.
kitaisreal retitled this revision from "[AggressiveInstCombine] Fold strcmp eq, 
not eq operator improvements" to "[AggressiveInstCombine][NFC] Fix typo".
kitaisreal edited the summary of this revision.
kitaisreal added a comment.
Herald added a reviewer: aaron.ballman.
Herald added subscribers: cfe-commits, wangpc.
Herald added a project: clang.

Transformed this to fix typo after https://reviews.llvm.org/D156620 was landed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156556/new/

https://reviews.llvm.org/D156556

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Parse/LoopHint.h
  clang/lib/Parse/ParsePragma.cpp
  llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp

Index: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
===================================================================
--- llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -934,13 +934,8 @@
   size_t ConstantStrSize = ConstantStr.size();
 
   // Trivial cases are optimized during inst combine
-  if (ConstantStrSize == 0) {
+  if (ConstantStrSize == 0 || ConstantStrSize > 2)
     return false;
-  }
-
-  if (ConstantStrSize > 2) {
-    return false;
-  }
 
   // Check if strcmp result is only used in a comparison with zero
   if (!isOnlyUsedInZeroComparison(CI))
@@ -960,7 +955,7 @@
   // For strcmp(P, "xy") do the following transformation:
   //
   // (before)
-  // dst = strcmp(P, "x")
+  // dst = strcmp(P, "xy")
   //
   // (after)
   // v0 = P[0] - 'x'
@@ -1000,19 +995,19 @@
         static_cast<unsigned char>(ConstantStr[CharacterIndexToCheck]));
     Value *CharacterSub =
         B.CreateNSWSub(StrCharacterValue, ConstantStrCharacterValue);
-    Value *IsCharacterSubZero =
+    Value *CharacterSubIsZero =
         B.CreateICmpEQ(CharacterSub, ConstantInt::get(RetType, 0));
-    BasicBlock *IsCharacterSubZeroBB =
+    BasicBlock *CharacterSubIsZeroBB =
         BasicBlock::Create(B.getContext(), "strcmp_expand_sub_is_zero",
                            InitialBB->getParent(), JoinBlock);
-    B.CreateCondBr(IsCharacterSubZero, IsCharacterSubZeroBB, JoinBlock);
+    B.CreateCondBr(CharacterSubIsZero, CharacterSubIsZeroBB, JoinBlock);
 
     ResultPHI->addIncoming(CharacterSub, B.GetInsertBlock());
     DTUpdates.emplace_back(DominatorTree::Insert, B.GetInsertBlock(),
-                           IsCharacterSubZeroBB);
+                           CharacterSubIsZeroBB);
 
-    B.SetInsertPoint(IsCharacterSubZeroBB);
-    DTUpdates.emplace_back(DominatorTree::Insert, IsCharacterSubZeroBB,
+    B.SetInsertPoint(CharacterSubIsZeroBB);
+    DTUpdates.emplace_back(DominatorTree::Insert, CharacterSubIsZeroBB,
                            JoinBlock);
   }
 
Index: clang/lib/Parse/ParsePragma.cpp
===================================================================
--- clang/lib/Parse/ParsePragma.cpp
+++ clang/lib/Parse/ParsePragma.cpp
@@ -1362,6 +1362,7 @@
   assert(!Toks.empty() &&
          "PragmaLoopHintInfo::Toks must contain at least one token.");
 
+
   // If no option is specified the argument is assumed to be a constant expr.
   bool OptionUnroll = false;
   bool OptionUnrollAndJam = false;
@@ -1382,6 +1383,7 @@
                   OptionPipelineDisabled;
   }
 
+
   bool AssumeSafetyArg = !OptionUnroll && !OptionUnrollAndJam &&
                          !OptionDistribute && !OptionPipelineDisabled;
   // Verify loop hint has an argument.
Index: clang/include/clang/Parse/LoopHint.h
===================================================================
--- clang/include/clang/Parse/LoopHint.h
+++ clang/include/clang/Parse/LoopHint.h
@@ -27,6 +27,7 @@
   // Name of the loop hint.  Examples: "unroll", "vectorize".  In the
   // "#pragma unroll" and "#pragma nounroll" cases, this is identical to
   // PragmaNameLoc.
+
   IdentifierLoc *OptionLoc = nullptr;
   // Identifier for the hint state argument.  If null, then the state is
   // default value such as for "#pragma unroll".
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -3687,6 +3687,7 @@
 def LoopHint : Attr {
   /// #pragma clang loop <option> directive
   /// vectorize: vectorizes loop operations if State == Enable.
+  /// force_vectorize: force vectorizes loop operations if State == Enable.
   /// vectorize_width: vectorize loop operations with width 'Value'.
   /// interleave: interleave multiple loop iterations if State == Enable.
   /// interleave_count: interleaves 'Value' loop iterations.
@@ -3709,7 +3710,7 @@
 
   /// State of the loop optimization specified by the spelling.
   let Args = [EnumArgument<"Option", "OptionType",
-                          ["vectorize", "vectorize_width", "interleave", "interleave_count",
+                          ["vectorize", "force_vectorize", "vectorize_width", "interleave", "interleave_count",
                            "unroll", "unroll_count", "unroll_and_jam", "unroll_and_jam_count",
                            "pipeline", "pipeline_initiation_interval", "distribute",
                            "vectorize_predicate"],
@@ -3728,6 +3729,7 @@
   static const char *getOptionName(int Option) {
     switch(Option) {
     case Vectorize: return "vectorize";
+    case ForceVectorize: return "force_vectorize";
     case VectorizeWidth: return "vectorize_width";
     case Interleave: return "interleave";
     case InterleaveCount: return "interleave_count";
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to