From a1b2086a33dbfe4bea86acbb77611ffafd6245f1 Mon Sep 17 00:00:00 2001 From: Siddharth Bhat Date: Thu, 13 Jul 2017 12:18:56 +0000 Subject: [Invariant Loads] Do not consider invariant loads to have dependences. We need to relax constraints on invariant loads so that they do not create fake RAW dependences. So, we do not consider invariant loads as scalar dependences in a region. During these changes, it turned out that we do not consider `llvm::Value` replacements correctly within `PPCGCodeGeneration` and `ISLNodeBuilder`. The replacements dictated by `ValueMap` were not being followed in all places. This was fixed in this commit. There is no clean way to decouple this change because this bug only seems to arise when the relaxed version of invariant load hoisting was enabled. Differential Revision: https://reviews.llvm.org/D35120 llvm-svn: 307907 --- polly/lib/CodeGen/PPCGCodeGeneration.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp') diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 93a8417d8860..7b096a1917a2 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -1358,7 +1358,16 @@ GPUNodeBuilder::getReferencesInKernel(ppcg_kernel *Kernel) { SetVector ValidSubtreeFunctions( getFunctionsFromRawSubtreeValues(SubtreeValues)); - return std::make_pair(ValidSubtreeValues, ValidSubtreeFunctions); + // @see IslNodeBuilder::getReferencesInSubtree + SetVector ReplacedValues; + for (Value *V : ValidSubtreeValues) { + auto It = ValueMap.find(V); + if (It == ValueMap.end()) + ReplacedValues.insert(V); + else + ReplacedValues.insert(It->second); + } + return std::make_pair(ReplacedValues, ValidSubtreeFunctions); } void GPUNodeBuilder::clearDominators(Function *F) { @@ -1524,6 +1533,8 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F, for (long i = 0; i < NumVars; i++) { isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_param, i); Value *Val = IDToValue[Id]; + if (ValueMap.count(Val)) + Val = ValueMap[Val]; isl_id_free(Id); ArgSizes[Index] = computeSizeInBytes(Val->getType()); -- cgit v1.2.3