[PATCH] D23920: [StatepointsForGC] Identify PHI values for rematerialization
Anna Thomas via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 26 05:32:34 PDT 2016
anna created this revision.
anna added reviewers: sanjoy, reames.
anna added a subscriber: llvm-commits.
While walking the use chain for identifying rematerializable values in RS4GC,
add the case where the current value and base value are the same PHI nodes.
This will aid rematerialization instead of adding gc.relocate.
https://reviews.llvm.org/D23920
Files:
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
Index: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===================================================================
--- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -1813,6 +1813,20 @@
CI->getOperand(0), BaseValue);
}
+ // PHI nodes that have the same incoming values, and belonging to the same
+ // basic blocks are essentially the same SSA value.
+ if (PHINode *PhiCurr = dyn_cast<PHINode>(CurrentValue))
+ if (PHINode *PhiBase = dyn_cast<PHINode>(BaseValue)) {
+ int phiNum = PhiCurr->getNumIncomingValues();
+ if (phiNum != PhiBase->getNumIncomingValues() ||
+ PhiCurr->getParent() != PhiBase->getParent())
+ return false;
+ for (unsigned i = 0; i < phiNum; i++)
+ if (PhiCurr->getIncomingValue(i) != PhiBase->getIncomingValue(i))
+ return false;
+ return true;
+ }
+
// Not supported instruction in the chain
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23920.69357.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160826/d0cbb3c2/attachment.bin>
More information about the llvm-commits
mailing list