summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/IslNodeBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'polly/lib/CodeGen/IslNodeBuilder.cpp')
-rw-r--r--polly/lib/CodeGen/IslNodeBuilder.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index 2ec744603b9..db23319183a 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -322,6 +322,22 @@ void IslNodeBuilder::getReferencesInSubtree(__isl_keep isl_ast_node *For,
Loops.remove_if([this](const Loop *L) {
return S.contains(L) || L->contains(S.getEntry());
});
+
+ // Contains Values that may need to be replaced with other values
+ // due to replacements from the ValueMap. We should make sure
+ // that we return correctly remapped values.
+ // NOTE: this code path is tested by:
+ // 1. test/Isl/CodeGen/OpenMP/single_loop_with_loop_invariant_baseptr.ll
+ // 2. test/Isl/CodeGen/OpenMP/loop-body-references-outer-values-3.ll
+ SetVector<Value *> ReplacedValues;
+ for (Value *V : Values) {
+ auto It = ValueMap.find(V);
+ if (It == ValueMap.end())
+ ReplacedValues.insert(V);
+ else
+ ReplacedValues.insert(It->second);
+ }
+ Values = ReplacedValues;
}
void IslNodeBuilder::updateValues(ValueMapT &NewValues) {
OpenPOWER on IntegriCloud