[llvm] r179622 - Print out the target-independent attributes in a comment before the function definition.
Timur Iskhodzhanov
timurrrr at google.com
Wed Apr 17 03:53:59 PDT 2013
Hi Bill,
I see
"Assertion failed: begin() + idx < end(), file
D:\src\llvm-dev\include\llvm/ADT/SmallVector.h, line 140"
// idx=1, size=1
failures on my Windows build which has
`anonymous namespace'::AssemblyWriter::printFunction() + 0x11E
bytes(s), lib\ir\asmwriter.cpp, line 1618 + 0xE byte(s)
`anonymous namespace'::AssemblyWriter::printModule() + 0x41F
bytes(s), lib\ir\asmwriter.cpp, line 1378 + 0x14 byte(s)
in the middle of a stack.
Just in case, I've observed these assertions on
python bin\llvm-lit -v ..\tools\clang\test --filter="microsoft|win32"
on Windows.
I think only -cc1 -emit-llvm is affected, not -c.
Reverting your change locally has fixed my test runs.
Mind taking a look?
Thanks,
Timur
2013/4/17 Bill Wendling <isanbard at gmail.com>:
> Author: void
> Date: Tue Apr 16 15:55:47 2013
> New Revision: 179622
>
> URL: http://llvm.org/viewvc/llvm-project?rev=179622&view=rev
> Log:
> Print out the target-independent attributes in a comment before the function definition.
>
> Modified:
> llvm/trunk/lib/IR/AsmWriter.cpp
>
> Modified: llvm/trunk/lib/IR/AsmWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=179622&r1=179621&r2=179622&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/AsmWriter.cpp (original)
> +++ llvm/trunk/lib/IR/AsmWriter.cpp Tue Apr 16 15:55:47 2013
> @@ -1605,6 +1605,29 @@ void AssemblyWriter::printFunction(const
> if (F->isMaterializable())
> Out << "; Materializable\n";
>
> + const AttributeSet &Attrs = F->getAttributes();
> + if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) {
> + AttributeSet AS = Attrs.getFnAttributes();
> + std::string AttrStr;
> +
> + unsigned Idx = 0;
> + for (unsigned E = AS.getNumSlots(); Idx != E; ++Idx)
> + if (AS.getSlotIndex(Idx) == AttributeSet::FunctionIndex)
> + break;
> +
> + for (AttributeSet::iterator I = AS.begin(Idx), E = AS.end(Idx);
> + I != E; ++I) {
> + Attribute Attr = *I;
> + if (!Attr.isStringAttribute()) {
> + if (!AttrStr.empty()) AttrStr += ' ';
> + AttrStr += Attr.getAsString();
> + }
> + }
> +
> + if (!AttrStr.empty())
> + Out << "; Function Attrs: " << AttrStr << '\n';
> + }
> +
> if (F->isDeclaration())
> Out << "declare ";
> else
> @@ -1620,7 +1643,6 @@ void AssemblyWriter::printFunction(const
> }
>
> FunctionType *FT = F->getFunctionType();
> - const AttributeSet &Attrs = F->getAttributes();
> if (Attrs.hasAttributes(AttributeSet::ReturnIndex))
> Out << Attrs.getAsString(AttributeSet::ReturnIndex) << ' ';
> TypePrinter.print(F->getReturnType(), Out);
> @@ -1761,10 +1783,8 @@ void AssemblyWriter::printBasicBlock(con
> /// which slot it occupies.
> ///
> void AssemblyWriter::printInfoComment(const Value &V) {
> - if (AnnotationWriter) {
> + if (AnnotationWriter)
> AnnotationWriter->printInfoComment(V, Out);
> - return;
> - }
> }
>
> // This member is called for each Instruction in a function..
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list