Improve dumping IR module

This patch allows the final module IR for a query be saved to disk
before and after optimization.

Change-Id: I0147bb93516b8094e0516981935729bf226fc35b
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1517
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins