[polly] r309947 - [VirtualInstruction] Avoid use of getStmtFor(BB). NFC.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 08:27:01 PDT 2017
Author: meinersbur
Date: Thu Aug 3 08:27:00 2017
New Revision: 309947
URL: http://llvm.org/viewvc/llvm-project?rev=309947&view=rev
Log:
[VirtualInstruction] Avoid use of getStmtFor(BB). NFC.
With this patch, we get rid of the last use of getStmtFor(BB). Here
this is done by getting the last statement of the incoming block in
case the user is a phi node; otherwise just fetching the statement
comprising the instruction for which the virtual use is being created.
Differential Revision: https://reviews.llvm.org/D36268
Modified:
polly/trunk/lib/Support/VirtualInstruction.cpp
Modified: polly/trunk/lib/Support/VirtualInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/VirtualInstruction.cpp?rev=309947&r1=309946&r2=309947&view=diff
==============================================================================
--- polly/trunk/lib/Support/VirtualInstruction.cpp (original)
+++ polly/trunk/lib/Support/VirtualInstruction.cpp Thu Aug 3 08:27:00 2017
@@ -21,7 +21,12 @@ using namespace llvm;
VirtualUse VirtualUse ::create(Scop *S, const Use &U, LoopInfo *LI,
bool Virtual) {
auto *UserBB = getUseBlock(U);
- auto *UserStmt = S->getStmtFor(UserBB);
+ Instruction *UI = dyn_cast<Instruction>(U.getUser());
+ ScopStmt *UserStmt = nullptr;
+ if (PHINode *PHI = dyn_cast<PHINode>(UI))
+ UserStmt = S->getLastStmtFor(PHI->getIncomingBlock(U));
+ else
+ UserStmt = S->getStmtFor(UI);
auto *UserScope = LI->getLoopFor(UserBB);
return create(S, UserStmt, UserScope, U.get(), Virtual);
}
More information about the llvm-commits
mailing list