5e306b944425a952fe744f59d828538137a59375 |
|
09-Feb-2016 |
David Gross <dgross@google.com> |
Change mechanism used to ensure #pragma rs reduce functions are not deleted. Requires corresponding change in frameworks/compile/libbcc. The functions referenced by "#pragma rs reduce" are static functions. If the only references to such a function are from these pragmas, then the function looks unreferenced, and hence without additional work will be deleted by clang. The old solution to this problem is to add all such functions to the LLVM intrinsic variable @llvm.used. Unfortunately, this doesn't just prevent clang from deleting these functions -- it also prevents llvm from deleting these functions. This is undesirable in the case of the combiner function (which is not currently needed by the CPU reference driver) or the accumulator function (because the CPU reference driver needs an "expanded" form of the accumulator function, not the original accumulator function). The new solution is that for each such function "f" we generate a dummy variable initialized with a pointer to that function: void *.rs.reduce_fn.f = (void*)&f; This prevents clang from deleting "f", but does not automatically prevent llvm from deleting "f" (e.g., the backend could use some other mechanism to retain "f" if necessary, while deleting ".rs.reduce_fn.f"). Bug: 23535724 (cherry picked from commit 633f2980e148775887f0d416f8dd663a6d3b48df) Change-Id: I272445d2bf706cde8d81ed65aa32df59c3ba0e47
/frameworks/compile/slang/tests/P_reduce_general_examples_backward/ScriptC_reduce_general_examples_backward.java.expect
|