[LLVMbugs] [Bug 807] NEW: perform substitution when equality is known

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jun 10 12:38:13 PDT 2006


           Summary: perform substitution when equality is known
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca

The following code doesn't optimize down:

// Source: pag.csail.mit.edu/paste2005/slides/yang-paste2005-slides.ppt

extern void foo();

void process(int *p, int *q)
  if (p != q)

  if (*p != *q)
    foo(); // unreachable

In a branch whose condition depends on a EQ or NE, in the side where the
variables are equal (and if the types are equal (?)), replaceAllUsesOfWith(p,
q). This allows the compiler to optimize away the following test and should kill
the liveness of one of the variables. I suppose you could also do the same
optimization with a switch instruction.

Where would such an optimization belong? The instruction combiner?

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list