[llvm-commits] [llvm] r65307 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/DebugLoc.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/InstCombine/2009-02-21-LoadCST.ll

Bill Wendling isanbard at gmail.com
Sun Feb 22 22:04:32 PST 2009


Author: void
Date: Mon Feb 23 00:04:32 2009
New Revision: 65307

URL: http://llvm.org/viewvc/llvm-project?rev=65307&view=rev
Log:
Pull r65246 into Dib:

Don't sign extend the char when expanding char -> int during
load(bitcast(char[4] to i32*)) evaluation.

Added:
    llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
      - copied unchanged from r65246, llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
Modified:
    llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h
    llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
    llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h?rev=65307&r1=65306&r2=65307&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h Mon Feb 23 00:04:32 2009
@@ -22,11 +22,25 @@
 
   /// DebugLocTuple - Debug location tuple of filename id, line and column.
   ///
-  struct DebugLocTuple {
-    unsigned Src, Line, Col;
+  class DebugLocTuple {
+    enum { Mask = 0xFFFFFFFFUL };
+    uint64_t Src, Line, ScopeCol;
+  public:
+    DebugLocTuple(uint64_t s, uint64_t l, uint64_t p, uint64_t c)
+      : Src(s), Line(l), Col((p << 32) | (c & Mask)) {};
 
-    DebugLocTuple(unsigned s, unsigned l, unsigned c)
-      : Src(s), Line(l), Col(c) {};
+    uint64_t getSource() const {
+      return Src;
+    }
+    uint64_t getLine() const {
+      return Line;
+    }
+    uint32_t getScope() const {
+      return (ScopeCol >> 32) & Mask;
+    }
+    uint32_t getCol() const {
+      return ScopeCol & Mask;
+    }
 
     bool operator==(const DebugLocTuple &DLT) const {
       return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col;

Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65307&r1=65306&r2=65307&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 23 00:04:32 2009
@@ -11028,12 +11028,12 @@
         APInt SingleChar(numBits, 0);
         if (TD->isLittleEndian()) {
           for (signed i = len-1; i >= 0; i--) {
-            SingleChar = (uint64_t) Str[i];
+            SingleChar = (uint64_t) Str[i] & UCHAR_MAX;
             StrVal = (StrVal << 8) | SingleChar;
           }
         } else {
           for (unsigned i = 0; i < len; i++) {
-            SingleChar = (uint64_t) Str[i];
+            SingleChar = (uint64_t) Str[i] & UCHAR_MAX;
             StrVal = (StrVal << 8) | SingleChar;
           }
           // Append NULL at the end.

Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp?rev=65307&r1=65306&r2=65307&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 23 00:04:32 2009
@@ -33,6 +33,11 @@
 
 STATISTIC(NumSpeculations, "Number of speculative executed instructions");
 
+#include "llvm/Support/CommandLine.h"
+
+static cl::opt<bool>
+DisableOpt("disable-opt", cl::Hidden, cl::init(false));
+
 /// SafeToMergeTerminators - Return true if it is safe to merge these two
 /// terminator instructions together.
 ///
@@ -1778,7 +1783,7 @@
       }
 
       // If we found some, do the transformation!
-      if (!UncondBranchPreds.empty()) {
+      if (!UncondBranchPreds.empty() && !DisableOpt) {
         while (!UncondBranchPreds.empty()) {
           BasicBlock *Pred = UncondBranchPreds.back();
           DOUT << "FOLDING: " << *BB





More information about the llvm-commits mailing list