impala-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Ho (Code Review)" <>
Subject [Impala-CR](cdh5-trunk) IMPALA-3906: Materialize implicitly referenced IR functions
Date Tue, 26 Jul 2016 00:25:16 GMT
Hello Tim Armstrong,

I'd like you to reexamine a change.  Please visit

to look at the new patch set (#3).

Change subject: IMPALA-3906: Materialize implicitly referenced IR functions

IMPALA-3906: Materialize implicitly referenced IR functions

With lazy materialization of IR functions in the LLVM module,
there is an assumption that functions not referenced by IR
functions used in the query don't have to be materialized
and can have their linkage types changed to being externally
defined. These unmaterialized functions may be referenced by
global variables in the LLVM module and LLVM resolves these
references to their definitions in the native Impalad binary.
These global variables are mostly arrays containing references
to other global constants or boost and Impala functions included
in the cross-compiled code.

When compiling Impalad with optimization, gcc may actually
inline some of the functions which the global variables in
the LLVM modules reference and LLVM may have linking error
if these referenced IR functions are not materialized as it
can no longer find their definitions in the Impalad binary.
This patch fixes the problem by parsing all the global variables
in the LLVM module during Impalad's initialization and recording
all the referenced functions which aren't defined in the Impalad
binary and make sure they are always materialized.

A second problem which this patch fixes is that linking in
external LLVM module (e.g. UDF IR created by a user) may
implicitly materialize some functions in the external module.
Normally, we would expect functions to be materialized
through the GetFunction() interface and LinkModule() seems
to be an exception. This patch updates LinkModule() to also
parse the functions from the external module just like we do
for unmaterialized functions in GetFunction().

Change-Id: I3653f55a1aa063b21cb3a5040f502b4c0ecf82e8
M be/src/codegen/
M be/src/codegen/llvm-codegen.h
M be/src/util/
3 files changed, 127 insertions(+), 27 deletions(-)

  git pull ssh:// refs/changes/40/3740/3
To view, visit
To unsubscribe, visit

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3653f55a1aa063b21cb3a5040f502b4c0ecf82e8
Gerrit-PatchSet: 3
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Michael Ho <>
Gerrit-Reviewer: Michael Ho <>
Gerrit-Reviewer: Tim Armstrong <>

View raw message