[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp

Vikram Adve vadve at cs.uiuc.edu
Thu Aug 7 10:02:01 PDT 2003


Changes in directory llvm/lib/Target/Sparc:

SparcInstrSelection.cpp updated: 1.112 -> 1.113

---
Log message:

Fix sanity-checking in 'maskUnsigned' code to be more precise:
use or def-and-use operands can be substituted after one def-only
operand has been substituted.


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.112 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.113
--- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.112	Wed Aug  6 13:48:40 2003
+++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp	Thu Aug  7 10:01:26 2003
@@ -2859,9 +2859,19 @@
 
         unsigned numSubst = 0;
         for (unsigned i=0, N=mvec.size(); i < N; ++i) {
+
+          // Make sure we substitute all occurrences of dest in these instrs.
+          // Otherwise, we will have bogus code.
           bool someArgsWereIgnored = false;
-          numSubst += mvec[i]->substituteValue(dest, tmpI, /*defsOnly*/ true,
-                                               /*defsAndUses*/ false,
+
+          // Make sure not to substitute an upwards-exposed use -- that would
+          // introduce a use of `tmpI' with no preceding def.  Therefore,
+          // substitute a use or def-and-use operand only if a previous def
+          // operand has already been substituted (i.e., numSusbt > 0).
+          // 
+          numSubst += mvec[i]->substituteValue(dest, tmpI,
+                                               /*defsOnly*/ numSubst == 0,
+                                               /*notDefsAndUses*/ numSubst > 0,
                                                someArgsWereIgnored);
           assert(!someArgsWereIgnored &&
                  "Operand `dest' exists but not replaced: probably bogus!");





More information about the llvm-commits mailing list