[polly] r309674 - [NFC] [IslNodeBuilder, GPUNodeBuilder] Unify mechanism for looking up replacement Values.
Siddharth Bhat via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 05:15:51 PDT 2017
Author: bollu
Date: Tue Aug 1 05:15:51 2017
New Revision: 309674
URL: http://llvm.org/viewvc/llvm-project?rev=309674&view=rev
Log:
[NFC] [IslNodeBuilder, GPUNodeBuilder] Unify mechanism for looking up replacement Values.
We populate `IslNodeBuilder::ValueMap` which contains replacements for
`llvm::Value`s. There was no simple method to pick up a replacement if
it exists, otherwise fall back to the original.
Create a method `IslNodeBuilder::getLatestValue` which provides this
functionality.
This will be used in a later patch to fix bugs in `PPCGCodeGeneration`
where the latest value is not being used.
Differential Revision: https://reviews.llvm.org/D36000
Modified:
polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
Modified: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslNodeBuilder.h?rev=309674&r1=309673&r2=309674&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Tue Aug 1 05:15:51 2017
@@ -262,6 +262,14 @@ protected:
/// @param NewValues A map that maps certain llvm::Values to new llvm::Values.
void updateValues(ValueMapT &NewValues);
+ /// Return the most up-to-date version of the llvm::Value for code generation.
+ /// @param Original The Value to check for an up to date version.
+ /// @returns A remapped `Value` from ValueMap, or `Original` if no mapping
+ /// exists.
+ /// @see IslNodeBuilder::updateValues
+ /// @see IslNodeBuilder::ValueMap
+ Value *getLatestValue(Value *Original) const;
+
/// Generate code for a marker now.
///
/// For mark nodes with an unknown name, we just forward the code generation
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=309674&r1=309673&r2=309674&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Tue Aug 1 05:15:51 2017
@@ -324,11 +324,7 @@ void IslNodeBuilder::getReferencesInSubt
// 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);
+ ReplacedValues.insert(getLatestValue(V));
}
Values = ReplacedValues;
}
@@ -349,6 +345,13 @@ void IslNodeBuilder::updateValues(ValueM
}
}
+Value *IslNodeBuilder::getLatestValue(Value *Original) const {
+ auto It = ValueMap.find(Original);
+ if (It == ValueMap.end())
+ return Original;
+ return It->second;
+}
+
void IslNodeBuilder::createUserVector(__isl_take isl_ast_node *User,
std::vector<Value *> &IVS,
__isl_take isl_id *IteratorID,
More information about the llvm-commits
mailing list