diff options
| author | Fangrui Song <maskray@google.com> | 2019-04-14 05:48:13 +0000 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-04-14 05:48:13 +0000 |
| commit | 8f9bb2250b099a1c1bdf2532ed07511b267216c3 (patch) | |
| tree | 4a7e1b2fd9ac2a5a49900a41765aa05774bda402 | |
| parent | dabd80047e0c12bb0eecf85928feeba5342634a5 (diff) | |
| download | bcm5719-llvm-8f9bb2250b099a1c1bdf2532ed07511b267216c3.tar.gz bcm5719-llvm-8f9bb2250b099a1c1bdf2532ed07511b267216c3.zip | |
[Mem2Reg] Simplify rewriteSingleStoreAlloca
llvm-svn: 358349
| -rw-r--r-- | llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 74019c5d302..28462e8c8b6 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -362,10 +362,8 @@ static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, for (auto UI = AI->user_begin(), E = AI->user_end(); UI != E;) { Instruction *UserInst = cast<Instruction>(*UI++); - if (!isa<LoadInst>(UserInst)) { - assert(UserInst == OnlyStore && "Should only have load/stores"); + if (UserInst == OnlyStore) continue; - } LoadInst *LI = cast<LoadInst>(UserInst); // Okay, if we have a load from the alloca, we want to replace it with the @@ -385,8 +383,7 @@ static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, Info.UsingBlocks.push_back(StoreBB); continue; } - } else if (LI->getParent() != StoreBB && - !DT.dominates(StoreBB, LI->getParent())) { + } else if (!DT.dominates(StoreBB, LI->getParent())) { // If the load and store are in different blocks, use BB dominance to // check their relationships. If the store doesn't dom the use, bail // out. |

