diff options
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r-- | polly/lib/Support/ScopHelper.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp index 9bdfbc3e530..63f91b81e13 100644 --- a/polly/lib/Support/ScopHelper.cpp +++ b/polly/lib/Support/ScopHelper.cpp @@ -442,3 +442,14 @@ bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI, return false; } + +llvm::BasicBlock *polly::getUseBlock(llvm::Use &U) { + Instruction *UI = dyn_cast<Instruction>(U.getUser()); + if (!UI) + return nullptr; + + if (PHINode *PHI = dyn_cast<PHINode>(UI)) + return PHI->getIncomingBlock(U); + + return UI->getParent(); +} |