[PATCH] D60602: [InferAddressSpaces] Add AS parameter to the pass factory
Sven van Haastregt via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 02:21:06 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359290: [InferAddressSpaces] Add AS parameter to the pass factory (authored by svenvh, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D60602?vs=195556&id=196819#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60602/new/
https://reviews.llvm.org/D60602
Files:
llvm/trunk/include/llvm/Transforms/Scalar.h
llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
Index: llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -148,7 +148,9 @@
public:
static char ID;
- InferAddressSpaces() : FunctionPass(ID) {}
+ InferAddressSpaces() :
+ FunctionPass(ID), FlatAddrSpace(UninitializedAddressSpace) {}
+ InferAddressSpaces(unsigned AS) : FunctionPass(ID), FlatAddrSpace(AS) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
@@ -624,9 +626,12 @@
const TargetTransformInfo &TTI =
getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
- FlatAddrSpace = TTI.getFlatAddressSpace();
- if (FlatAddrSpace == UninitializedAddressSpace)
- return false;
+
+ if (FlatAddrSpace == UninitializedAddressSpace) {
+ FlatAddrSpace = TTI.getFlatAddressSpace();
+ if (FlatAddrSpace == UninitializedAddressSpace)
+ return false;
+ }
// Collects all flat address expressions in postorder.
std::vector<WeakTrackingVH> Postorder = collectFlatAddressExpressions(F);
@@ -1018,6 +1023,6 @@
return true;
}
-FunctionPass *llvm::createInferAddressSpacesPass() {
- return new InferAddressSpaces();
+FunctionPass *llvm::createInferAddressSpacesPass(unsigned AddressSpace) {
+ return new InferAddressSpaces(AddressSpace);
}
Index: llvm/trunk/include/llvm/Transforms/Scalar.h
===================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar.h
+++ llvm/trunk/include/llvm/Transforms/Scalar.h
@@ -383,9 +383,10 @@
//
// InferAddressSpaces - Modify users of addrspacecast instructions with values
// in the source address space if using the destination address space is slower
-// on the target.
+// on the target. If AddressSpace is left to its default value, it will be
+// obtained from the TargetTransformInfo.
//
-FunctionPass *createInferAddressSpacesPass();
+FunctionPass *createInferAddressSpacesPass(unsigned AddressSpace = ~0u);
extern char &InferAddressSpacesID;
//===----------------------------------------------------------------------===//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60602.196819.patch
Type: text/x-patch
Size: 2207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190426/6eaed170/attachment.bin>
More information about the llvm-commits
mailing list