[llvm-commits] [PATCH] removing a newline when printing a Global Variable
Saša Tomić
tomic80 at gmail.com
Fri Sep 7 05:39:47 PDT 2012
Hi Duncan,
On 09/07/2012 01:34 PM, Duncan Sands wrote:
> Hi Saša,
>
>> I'm not sure how to add a testcase, but I'll try to explain the issue
>> at hand.
>>
>> // You have: Value *a, *b, *c; And you call:
>> dbgs() << *a << "\n";
>> dbgs() << *b << "\n";
>> dbgs() << *c << "\n";
>>
>> This should print *a, *b, and *c with consistent formatting. For
>> example:
>> ---------
>> @shared = common global i32** null, align 8
>> %arrayidx = getelementptr inbounds i32** %4, i64 %idxprom, !dbg !26
>> %i = alloca i32, align 4
>> ---------
>>
>> However, if 'a' happens to be a global variable, its .print() method
>> will append
>> one more newline, like this:
>> ---------
>> @shared = common global i32** null, align 8
>>
>> %arrayidx = getelementptr inbounds i32** %4, i64 %idxprom, !dbg !26
>> %i = alloca i32, align 4
>> ---------
>
> OK, but this method is also using by llvm-dis and friends to turn
> bitcode into
> human readable IR. I think your patch is going to break that because all
> globals will now end up on the same line. Did you run the testsuite?
> In short,
> if you remove the newline here (which sounds like a good idea) then
> you will
> need to put an extra newline somewhere else to fix module printing (I
> don't
> know where, but hopefully you can find it).
>
I just couldn't let it go.
I found the other place where the function is used, and I have attached
a patch.
"make check" now gives the following output:
llvm[0]: Running test suite
make[1]: Entering directory `/home/stomic/projects/llvm/build/test'
Makefile:23: GREP_OPTIONS environment variable may interfere with test
results
Making LLVM 'lit.site.cfg' file...
Making LLVM unittest 'lit.site.cfg' file...
( ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v
1024000 ; \
/home/stomic/projects/llvm/utils/lit/lit.py -s -v . )
Testing Time: 30.81s
Expected Passes : 4758
Expected Failures : 26
Unsupported Tests : 1649
make[1]: Leaving directory `/home/stomic/projects/llvm/build/test'
Hope this means that all the tests passed.
BTW, I have noticed that printAlias() may suffer from the same problem,
although I haven't been affected so far (I didn't use aliases).
Best regards,
Sasha
--
best regards,
Saša
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globalvar.diff
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120907/c2da24e9/attachment.bin>
More information about the llvm-commits
mailing list