[LLVMbugs] [Bug 1383] NEW: new per-function attributes for pure/const

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu May 3 14:41:02 PDT 2007


http://llvm.org/bugs/show_bug.cgi?id=1383

           Summary: new per-function attributes for pure/const
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org


llvm-gcc knows that some function calls are pure/const based on flags that it gets passed.  For 
example, we noticed that CoyoteBench/almabench goes 2x faster with llvm+cbe+gcc than it does with 
either GCC or llvm alone.

It turns out that LLVM does a lot of memory promotion and other stuff that ends up making an entire 
chain of computation be used only by a dead call to asin.  Then the CBE+GCC are run, they nuke asin 
(and the large chain of scalar computations that feed it) because GCC on macos knows that asin is 
pure/const (darwin math libraries don't set errno), but llvm doesn't know this because it's not a safe 
assumption.

It would be preferable for the CFE to set the pure/const flags on external functions, when it knows 
them, allowing the optimizers to be more aggressive when safe.  This would let us handle this case (a 
huge speedup for almabench, woo? ), but it would also allow us to drop the huge tables in lib/Analysis/
BasicAliasAnalysis.cpp because libm headers already apply these attributes for GCCs use.

-Chris



------- 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