diff options
author | kkyzylov <ksenia.kyzylova@intel.com> | 2016-11-14 11:54:28 +0300 |
---|---|---|
committer | bader <alexey.bader@intel.com> | 2016-11-14 11:54:28 +0300 |
commit | 1772ae0a8517ac1d9df6790fdb622514d9244247 (patch) | |
tree | 48fe9ac7d67b7bbba63049e456ddc421d856a5ad /lib | |
parent | b042d2d26a27a3715988c9829f628eaa416aba62 (diff) |
Revert "Change ordering of blocks as required by SPIRV Spec (#195)" (#197)
This reverts commit 53688bd35ed4c279ec93b7229e3b741b7ab98b2c.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/SPIRV/SPIRVRegularizeLLVM.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/SPIRV/SPIRVRegularizeLLVM.cpp b/lib/SPIRV/SPIRVRegularizeLLVM.cpp index 022d2c1..1631b61 100644 --- a/lib/SPIRV/SPIRVRegularizeLLVM.cpp +++ b/lib/SPIRV/SPIRVRegularizeLLVM.cpp @@ -42,10 +42,8 @@ #include "SPIRVMDBuilder.h" #include "SPIRVMDWalker.h" -#include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" -#include "llvm/IR/CFG.h" #include "llvm/IR/InstVisitor.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IRBuilder.h" @@ -83,8 +81,6 @@ public: void lowerFuncPtr(Function *F, Op OC); void lowerFuncPtr(Module *M); - bool getSwitchCaseOrdering(BasicBlock *BB); - static char ID; private: Module *M; @@ -158,22 +154,6 @@ SPIRVRegularizeLLVM::regularize() { } } } - - if (F->getBasicBlockList().size() < 2)
- continue;
- // The order of blocks in a function must satisfy the rule
- // that blocks appear before all blocks they dominate.
- // We iterate over the SCCs in a graph in post-order
- for (scc_iterator<Function*> SCCI = scc_begin(F); !SCCI.isAtEnd(); ++SCCI) {
- const std::vector<BasicBlock *> &NextSCC = *SCCI;
- assert(!NextSCC.empty());
- for (const auto &I : NextSCC) {
- BasicBlock *BB = I;
- // The order of blocks in switch instruction shouldn't be changed
- if (!getSwitchCaseOrdering(BB))
- BB->moveAfter(&F->getEntryBlock());
- }
- } } std::string Err; @@ -225,26 +205,8 @@ SPIRVRegularizeLLVM::lowerFuncPtr(Module* M) { lowerFuncPtr(I.first, I.second); } -bool -SPIRVRegularizeLLVM::getSwitchCaseOrdering(BasicBlock *BB) { - // The order of the BBs was reversed - // We want to restore the original order of switch statement
- for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
- BasicBlock *Pred = *PI;
- // Check if we have a case value
- if (auto SI = dyn_cast<SwitchInst>(Pred->getTerminator())) {
- BasicBlock* Default = SI->getDefaultDest();
- if (BB == Default)
- BB->moveAfter(Pred);
- else
- BB->moveBefore(Default);
- return true;
- }
- } - return false; } -} INITIALIZE_PASS(SPIRVRegularizeLLVM, "spvregular", "Regularize LLVM for SPIR-V", false, false) |