[LLVMbugs] [Bug 9549] New: addRequiredTransitive() requires addPreserved().

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 25 07:29:16 PDT 2011


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

           Summary: addRequiredTransitive() requires addPreserved().
           Product: Documentation
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: General docs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ludw1g.m3i3r at gmail.com
                CC: llvmbugs at cs.uiuc.edu


When a pass is added to AnalysisUsage::addRequiredTransitive(), it is also
necessary to preserve this pass. Either through setPreservesAll(),
setPreservesCFG(), addPreserved() or addPreservedID().
When addPreserved is not called and assertions are enabled, the error reported
is:

Assertion `AnalysisPass && "Expected analysis pass to exist."' failed.

At least to me, it was not immediately obvious that this is due the missing
addPreserved call. 
So hereby i request this necessity to be explicitly documented at:
http://llvm.org/docs/WritingAnLLVMPass.html#AU::addRequired


Also i would welcome some explanation, why addRequiredTransitive has to be used
"In cases where analyses chain". To me it is even unclear what that means
exactly. I guess it means an analysis-pass using
getAnalysis<some-other-analysis-pass>.

Finally, i would also like some clarification on the difference between
analysis-passes and non-analyis-passes. Something along 
"If your pass doesn't modify the program it is an analysis-pass. So you have to
call RegisterPass( , , , true). Only then other passes can make use of your
pass throug getAnalysis()."
(The above paragraph may be entirely wrong of course. If I'd know the
difference, I wouldn't write this bug-report.)
A nice place for this explanation would be
http://llvm.org/docs/WritingAnLLVMPass.html#registration

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list