[llvm] r358349 - [Mem2Reg] Simplify rewriteSingleStoreAlloca
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 13 22:48:13 PDT 2019
Author: maskray
Date: Sat Apr 13 22:48:13 2019
New Revision: 358349
URL: http://llvm.org/viewvc/llvm-project?rev=358349&view=rev
Log:
[Mem2Reg] Simplify rewriteSingleStoreAlloca
Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=358349&r1=358348&r2=358349&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Apr 13 22:48:13 2019
@@ -362,10 +362,8 @@ static bool rewriteSingleStoreAlloca(All
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(All
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.
More information about the llvm-commits
mailing list