BSD 4_3_Reno development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 25 Jun 1990 07:55:58 +0000 (23:55 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 25 Jun 1990 07:55:58 +0000 (23:55 -0800)
Work on file usr/src/libexec/pcc/c2.tahoe/NOTES
Work on file usr/src/libexec/pcc/c2.tahoe/NOTES.2

Synthesized-from: CSRG/cd2/4.3reno

usr/src/libexec/pcc/c2.tahoe/NOTES [new file with mode: 0644]
usr/src/libexec/pcc/c2.tahoe/NOTES.2 [new file with mode: 0644]

diff --git a/usr/src/libexec/pcc/c2.tahoe/NOTES b/usr/src/libexec/pcc/c2.tahoe/NOTES
new file mode 100644 (file)
index 0000000..3d16ec0
--- /dev/null
@@ -0,0 +1,39 @@
+The pattern looks like this:
+
+       movl    P,rA
+       xxxl3   Q,rA,rB
+       yyyl2   R,rB
+
+xxx and yyy may be any of several binary operators like 'add',
+'mul', 'and'.  rA and rB must both be temporary registers.
+
+Here's how it happens...  We work backwards from the last instruction:
+
+       movl    P,rA
+       xxxl3   Q,rA,rB
+=>     yyyl2   R,rB
+
+Here we note that rB is a 'modify' operand and mark rB alive.
+
+       movl    P,rA
+=>     xxxl3   Q,rA,rB
+       yyyl2   R,rB
+
+We see that this instruction writes into rB and kills it, but since
+rB is previously alive, the store is not redundant and we leave it
+alone.
+
+=>     movl    P,rA
+       xxxl3   Q,rA,rB
+       yyyl2   R,rB
+
+We notice that this is a useless store into rA, since we can replace
+rA with P in the following instruction.  We delete this instruction
+and modify the following one.
+
+=>     xxxl3   Q,P,rB
+       yyyl2   R,rB
+
+Unfortunately rB is no longer alive because we killed it evaluating
+the earlier form of this very instruction.  The optimizer assumes that
+we have a redundant store and deletes the instruction.  Bleah.
diff --git a/usr/src/libexec/pcc/c2.tahoe/NOTES.2 b/usr/src/libexec/pcc/c2.tahoe/NOTES.2
new file mode 100644 (file)
index 0000000..1d6fc29
--- /dev/null
@@ -0,0 +1,18 @@
+This bug bears some striking similarities to the previous one...
+
+Sample code:
+
+       std     r0              # these three instructions get deleted
+       movl    4(r12),r2       # here too, but shouldn't
+       ldd     r0              # here too
+       test
+       jump
+       use of r2
+label:
+       instruction that kills r0
+
+If the movl is reordered above the std, it won't be deleted; if
+reordered below the ldd, it's still zapped.  If the test is 'tstl
+r12', it can get deleted too...  It doesn't seem to matter very
+much what the jump or use of r2 are, provided the jump is a relational
+one, of course.