diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-06-16 13:47:30 -0700 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-06-16 13:53:31 -0700 |
commit | 3e39cfe5b4af7a8496049f623cfce177dc1903d6 (patch) | |
tree | feeab5c951c0d48f68ddd7f512b6a787ad0c71b2 /llvm/lib/Transforms/Utils/LoopRotationUtils.cpp | |
parent | 5759e3ce6d03a8363779df2efea554a15ff61047 (diff) | |
download | llvm-3e39cfe5b4af7a8496049f623cfce177dc1903d6.zip llvm-3e39cfe5b4af7a8496049f623cfce177dc1903d6.tar.gz llvm-3e39cfe5b4af7a8496049f623cfce177dc1903d6.tar.bz2 |
Revert "Revert "InstSimplify: Require instruction be parented""
This reverts commit 0c03f48480f69b854f86d31235425b5cb71ac921.
Going to fix forward size regression instead due to more dependent patches needing to be reverted otherwise.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopRotationUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopRotationUtils.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index 1a9eaf24..d81db56 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -435,6 +435,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // Otherwise, create a duplicate of the instruction. Instruction *C = Inst->clone(); + C->insertBefore(LoopEntryBranch); + ++NumInstrsDuplicated; // Eagerly remap the operands of the instruction. @@ -444,7 +446,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // Avoid inserting the same intrinsic twice. if (auto *DII = dyn_cast<DbgVariableIntrinsic>(C)) if (DbgIntrinsics.count(makeHash(DII))) { - C->deleteValue(); + C->eraseFromParent(); continue; } @@ -457,7 +459,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // in the map. InsertNewValueIntoMap(ValueMap, Inst, V); if (!C->mayHaveSideEffects()) { - C->deleteValue(); + C->eraseFromParent(); C = nullptr; } } else { @@ -466,7 +468,6 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { if (C) { // Otherwise, stick the new instruction into the new block! C->setName(Inst->getName()); - C->insertBefore(LoopEntryBranch); if (auto *II = dyn_cast<AssumeInst>(C)) AC->registerAssumption(II); |