[llvm-commits] [llvm] r79539 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolutionExpressions.h include/llvm/Bitcode/LLVMBitCodes.h include/llvm/InstrTypes.h include/llvm/Operator.h lib/Analysis/ScalarEvolution.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp

Dan Gohman gohman at apple.com
Thu Aug 20 10:11:38 PDT 2009


Author: djg
Date: Thu Aug 20 12:11:38 2009
New Revision: 79539

URL: http://llvm.org/viewvc/llvm-project?rev=79539&view=rev
Log:
Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
and hasNoSignedWrap, for consistency with the nuw and nsw properties.

Modified:
    llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
    llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
    llvm/trunk/include/llvm/InstrTypes.h
    llvm/trunk/include/llvm/Operator.h
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
    llvm/trunk/lib/VMCore/AsmWriter.cpp
    llvm/trunk/lib/VMCore/Constants.cpp

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Thu Aug 20 12:11:38 2009
@@ -426,12 +426,12 @@
       return cast<SCEVAddRecExpr>(SE.getAddExpr(this, getStepRecurrence(SE)));
     }
 
-    bool hasNoUnsignedOverflow() const { return SubclassData & (1 << 0); }
-    void setHasNoUnsignedOverflow(bool B) {
+    bool hasNoUnsignedWrap() const { return SubclassData & (1 << 0); }
+    void setHasNoUnsignedWrap(bool B) {
       SubclassData = (SubclassData & ~(1 << 0)) | (B << 0);
     }
-    bool hasNoSignedOverflow() const { return SubclassData & (1 << 1); }
-    void setHasNoSignedOverflow(bool B) {
+    bool hasNoSignedWrap() const { return SubclassData & (1 << 1); }
+    void setHasNoSignedWrap(bool B) {
       SubclassData = (SubclassData & ~(1 << 1)) | (B << 1);
     }
 

Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Thu Aug 20 12:11:38 2009
@@ -180,8 +180,8 @@
   /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing
   /// OverflowingBinaryOperator's SubclassOptionalData contents.
   enum OverflowingBinaryOperatorOptionalFlags {
-    OBO_NO_UNSIGNED_OVERFLOW = 0,
-    OBO_NO_SIGNED_OVERFLOW = 1
+    OBO_NO_UNSIGNED_WRAP = 0,
+    OBO_NO_SIGNED_WRAP = 1
   };
 
   /// SDivOperatorOptionalFlags - Flags for serializing SDivOperator's

Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Thu Aug 20 12:11:38 2009
@@ -201,19 +201,19 @@
   static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
                                       const Twine &Name = "") {
     BinaryOperator *BO = CreateAdd(V1, V2, Name);
-    cast<AddOperator>(BO)->setHasNoSignedOverflow(true);
+    cast<AddOperator>(BO)->setHasNoSignedWrap(true);
     return BO;
   }
   static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
                                       const Twine &Name, BasicBlock *BB) {
     BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
-    cast<AddOperator>(BO)->setHasNoSignedOverflow(true);
+    cast<AddOperator>(BO)->setHasNoSignedWrap(true);
     return BO;
   }
   static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
                                       const Twine &Name, Instruction *I) {
     BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
-    cast<AddOperator>(BO)->setHasNoSignedOverflow(true);
+    cast<AddOperator>(BO)->setHasNoSignedWrap(true);
     return BO;
   }
 

Modified: llvm/trunk/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Operator.h (original)
+++ llvm/trunk/include/llvm/Operator.h Thu Aug 20 12:11:38 2009
@@ -69,21 +69,21 @@
 class OverflowingBinaryOperator : public Operator {
   ~OverflowingBinaryOperator(); // do not implement
 public:
-  /// hasNoUnsignedOverflow - Test whether this operation is known to never
-  /// undergo unsigned overflow.
-  bool hasNoUnsignedOverflow() const {
+  /// hasNoUnsignedWrap - Test whether this operation is known to never
+  /// undergo unsigned overflow, aka the nuw property.
+  bool hasNoUnsignedWrap() const {
     return SubclassOptionalData & (1 << 0);
   }
-  void setHasNoUnsignedOverflow(bool B) {
+  void setHasNoUnsignedWrap(bool B) {
     SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0);
   }
 
-  /// hasNoSignedOverflow - Test whether this operation is known to never
-  /// undergo signed overflow.
-  bool hasNoSignedOverflow() const {
+  /// hasNoSignedWrap - Test whether this operation is known to never
+  /// undergo signed overflow, aka the nsw property.
+  bool hasNoSignedWrap() const {
     return SubclassOptionalData & (1 << 1);
   }
-  void setHasNoSignedOverflow(bool B) {
+  void setHasNoSignedWrap(bool B) {
     SubclassOptionalData = (SubclassOptionalData & ~(1 << 1)) | (B << 1);
   }
 

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Thu Aug 20 12:11:38 2009
@@ -795,7 +795,7 @@
 
       // If we have special knowledge that this addrec won't overflow,
       // we don't need to do any further analysis.
-      if (AR->hasNoUnsignedOverflow())
+      if (AR->hasNoUnsignedWrap())
         return getAddRecExpr(getZeroExtendExpr(Start, Ty),
                              getZeroExtendExpr(Step, Ty),
                              L);
@@ -934,7 +934,7 @@
 
       // If we have special knowledge that this addrec won't overflow,
       // we don't need to do any further analysis.
-      if (AR->hasNoSignedOverflow())
+      if (AR->hasNoSignedWrap())
         return getAddRecExpr(getSignExtendExpr(Start, Ty),
                              getSignExtendExpr(Step, Ty),
                              L);
@@ -2497,17 +2497,17 @@
                     getSCEV(OBO->getOperand(1)) ==
                       PHISCEV->getStepRecurrence(*this)) {
                   const SCEVAddRecExpr *PostInc = PHISCEV->getPostIncExpr(*this);
-                  if (OBO->hasNoUnsignedOverflow()) {
+                  if (OBO->hasNoUnsignedWrap()) {
                     const_cast<SCEVAddRecExpr *>(PHISCEV)
-                      ->setHasNoUnsignedOverflow(true);
+                      ->setHasNoUnsignedWrap(true);
                     const_cast<SCEVAddRecExpr *>(PostInc)
-                      ->setHasNoUnsignedOverflow(true);
+                      ->setHasNoUnsignedWrap(true);
                   }
-                  if (OBO->hasNoSignedOverflow()) {
+                  if (OBO->hasNoSignedWrap()) {
                     const_cast<SCEVAddRecExpr *>(PHISCEV)
-                      ->setHasNoSignedOverflow(true);
+                      ->setHasNoSignedWrap(true);
                     const_cast<SCEVAddRecExpr *>(PostInc)
-                      ->setHasNoSignedOverflow(true);
+                      ->setHasNoSignedWrap(true);
                   }
                 }
 

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Aug 20 12:11:38 2009
@@ -2082,9 +2082,9 @@
       return Error(ID.Loc,"constexpr requires integer, fp, or vector operands");
     Constant *C = ConstantExpr::get(Opc, Val0, Val1);
     if (NUW)
-      cast<OverflowingBinaryOperator>(C)->setHasNoUnsignedOverflow(true);
+      cast<OverflowingBinaryOperator>(C)->setHasNoUnsignedWrap(true);
     if (NSW)
-      cast<OverflowingBinaryOperator>(C)->setHasNoSignedOverflow(true);
+      cast<OverflowingBinaryOperator>(C)->setHasNoSignedWrap(true);
     if (Exact)
       cast<SDivOperator>(C)->setIsExact(true);
     ID.ConstantVal = C;
@@ -2665,9 +2665,9 @@
           return Error(ModifierLoc, "nsw only applies to integer operations");
       }
       if (NUW)
-        cast<OverflowingBinaryOperator>(Inst)->setHasNoUnsignedOverflow(true);
+        cast<OverflowingBinaryOperator>(Inst)->setHasNoUnsignedWrap(true);
       if (NSW)
-        cast<OverflowingBinaryOperator>(Inst)->setHasNoSignedOverflow(true);
+        cast<OverflowingBinaryOperator>(Inst)->setHasNoSignedWrap(true);
     }
     return Result;
   }

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Aug 20 12:11:38 2009
@@ -883,10 +883,10 @@
 static void SetOptimizationFlags(Value *V, uint64_t Flags) {
   if (OverflowingBinaryOperator *OBO =
         dyn_cast<OverflowingBinaryOperator>(V)) {
-    if (Flags & (1 << bitc::OBO_NO_SIGNED_OVERFLOW))
-      OBO->setHasNoSignedOverflow(true);
-    if (Flags & (1 << bitc::OBO_NO_UNSIGNED_OVERFLOW))
-      OBO->setHasNoUnsignedOverflow(true);
+    if (Flags & (1 << bitc::OBO_NO_SIGNED_WRAP))
+      OBO->setHasNoSignedWrap(true);
+    if (Flags & (1 << bitc::OBO_NO_UNSIGNED_WRAP))
+      OBO->setHasNoUnsignedWrap(true);
   } else if (SDivOperator *Div = dyn_cast<SDivOperator>(V)) {
     if (Flags & (1 << bitc::SDIV_EXACT))
       Div->setIsExact(true);

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Thu Aug 20 12:11:38 2009
@@ -461,10 +461,10 @@
 
   if (const OverflowingBinaryOperator *OBO =
         dyn_cast<OverflowingBinaryOperator>(V)) {
-    if (OBO->hasNoSignedOverflow())
-      Flags |= 1 << bitc::OBO_NO_SIGNED_OVERFLOW;
-    if (OBO->hasNoUnsignedOverflow())
-      Flags |= 1 << bitc::OBO_NO_UNSIGNED_OVERFLOW;
+    if (OBO->hasNoSignedWrap())
+      Flags |= 1 << bitc::OBO_NO_SIGNED_WRAP;
+    if (OBO->hasNoUnsignedWrap())
+      Flags |= 1 << bitc::OBO_NO_UNSIGNED_WRAP;
   } else if (const SDivOperator *Div = dyn_cast<SDivOperator>(V)) {
     if (Div->isExact())
       Flags |= 1 << bitc::SDIV_EXACT;

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Aug 20 12:11:38 2009
@@ -3084,7 +3084,7 @@
     if (SubOperator *Sub = dyn_cast<SubOperator>(Op0))
       if (isa<Constant>(Sub->getOperand(0)) &&
           cast<Constant>(Sub->getOperand(0))->isNullValue() &&
-          Sub->hasNoSignedOverflow())
+          Sub->hasNoSignedWrap())
         return BinaryOperator::CreateSDiv(Sub->getOperand(1),
                                           ConstantExpr::getNeg(RHS));
   }

Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Thu Aug 20 12:11:38 2009
@@ -895,9 +895,9 @@
 static void WriteOptimizationInfo(raw_ostream &Out, const User *U) {
   if (const OverflowingBinaryOperator *OBO =
         dyn_cast<OverflowingBinaryOperator>(U)) {
-    if (OBO->hasNoUnsignedOverflow())
+    if (OBO->hasNoUnsignedWrap())
       Out << " nuw";
-    if (OBO->hasNoSignedOverflow())
+    if (OBO->hasNoSignedWrap())
       Out << " nsw";
   } else if (const SDivOperator *Div = dyn_cast<SDivOperator>(U)) {
     if (Div->isExact())

Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=79539&r1=79538&r2=79539&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Thu Aug 20 12:11:38 2009
@@ -634,7 +634,7 @@
   // Set nsw attribute, assuming constant folding didn't eliminate the
   // Add.
   if (AddOperator *Add = dyn_cast<AddOperator>(C))
-    Add->setHasNoSignedOverflow(true);
+    Add->setHasNoSignedWrap(true);
   return C;
 }
 





More information about the llvm-commits mailing list