summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2003-08-07 15:01:26 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2003-08-07 15:01:26 +0000
commit97a95bdbddfa30815645296d95a8f655bf418f60 (patch)
tree2cd0a4355d2c420d877521390c7008bec15d9cf4
parent7d3c5795f9624cd2fd9cdf9a61a9eb055bbead4b (diff)
downloadllvm-97a95bdbddfa30815645296d95a8f655bf418f60.tar.gz
llvm-97a95bdbddfa30815645296d95a8f655bf418f60.tar.bz2
llvm-97a95bdbddfa30815645296d95a8f655bf418f60.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7674 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/SparcV9/SparcV9InstrSelection.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index b55bd4820e..1654c5592c 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -2859,9 +2859,19 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
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!");