[PATCH] D57033: [LCSSA] Handle case with single new PHI faster.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 24 13:09:45 PST 2019
fhahn updated this revision to Diff 183377.
fhahn retitled this revision from "[SSAUpdater] Handle case with single available value faster." to "[LCSSA] Handle case with single new PHI faster.".
fhahn edited the summary of this revision.
fhahn added a comment.
Moved change to LCSSA. Also shortens the runtime a tiny bit more.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57033/new/
https://reviews.llvm.org/D57033
Files:
llvm/lib/Transforms/Utils/LCSSA.cpp
Index: llvm/lib/Transforms/Utils/LCSSA.cpp
===================================================================
--- llvm/lib/Transforms/Utils/LCSSA.cpp
+++ llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -197,6 +197,16 @@
continue;
}
+ // If we added a single PHI, it must dominate all uses and we can directly
+ // rename it.
+ if (AddedPHIs.size() == 1) {
+ // Tell the VHs that the uses changed. This updates SCEV's caches.
+ if (UseToRewrite->get()->hasValueHandle())
+ ValueHandleBase::ValueIsRAUWd(*UseToRewrite, AddedPHIs[0]);
+ UseToRewrite->set(AddedPHIs[0]);
+ continue;
+ }
+
// Otherwise, do full PHI insertion.
SSAUpdate.RewriteUse(*UseToRewrite);
}
@@ -212,8 +222,9 @@
continue;
// We currently only handle debug values residing in blocks where we have
// inserted a PHI instruction.
- if (Value *V = SSAUpdate.FindValueForBlock(UserBB))
- DVI->setOperand(0, MetadataAsValue::get(Ctx, ValueAsMetadata::get(V)));
+ Value *V = AddedPHIs.size() == 1 ? AddedPHIs[0]
+ : SSAUpdate.FindValueForBlock(UserBB);
+ DVI->setOperand(0, MetadataAsValue::get(Ctx, ValueAsMetadata::get(V)));
}
// SSAUpdater might have inserted phi-nodes inside other loops. We'll need
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57033.183377.patch
Type: text/x-patch
Size: 1347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/c71462df/attachment.bin>
More information about the llvm-commits
mailing list