LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 960 - enhance bugpoint to reduce global initializers
Summary: enhance bugpoint to reduce global initializers
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: bugpoint (show other bugs)
Version: trunk
Hardware: All All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords: new-feature
Depends on:
Blocks:
 
Reported: 2006-10-20 22:41 PDT by Chris Lattner
Modified: 2010-02-22 12:43 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2006-10-20 22:41:37 PDT
It would be wonderful if someone would enhance bugpoint to prune down the list of global var initializers 
when some are required to provoke a compiler crash.  Domagoj Babic produced a patch that does exactly 
this:
http://lists.cs.uiuc.edu/pipermail/llvmbugs/2006-October/002004.html

... but his patch does not use the list reducer.  It would be great if someone could pick this up and finish 
it.

-Chris
Comment 1 Bill Wendling 2006-10-21 03:29:54 PDT
I have a potential patch for this (it compiles! Ship it!). Is there a test case that I can use to verify this 
against Domagoj's patch?

-bw
Comment 2 Chris Lattner 2006-10-21 23:13:45 PDT
I'd suggest going into lib/CodeGen/AsmPrinter.cpp.   In the 
AsmPrinter::EmitGlobalConstant method, add:

assert(CV->isNullValue());

you just inserted a 'bug'.  Recompile llc, then use:

bugpoint -run-llc myprogram.bc

Which should reduce it down to just one global that has a non-zero initializer.

-Chris
Comment 3 Bill Wendling 2006-10-23 03:26:48 PDT
Putting that line in didn't work. Bugpoint didn't even execute that method. :-(

-bw
Comment 4 Chris Lattner 2006-10-23 13:17:18 PDT
Right, bugpoint doesn't run the code generator.  however, it should fork off llc, which should.

Make sure you have a complex-enough .bc file, and use bugpoint -run-llc.
Comment 5 Bill Wendling 2006-10-25 13:43:43 PDT
I did run it with -run-llc, but nothing. I thought that the file was complex enough. Anyway, Domagoj 
checked and it did produce the same result as his patch. I submitted the patch. It can stand some 
improvement (like not cloning the Module each time).

-bw
Comment 7 Chris Lattner 2006-10-31 00:32:13 PST
Isn't this done, if so, shouldn't it be closed?

-Chris
Comment 8 Bill Wendling 2006-10-31 00:39:27 PST
Good point. Fixed here:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061023/039047.html