aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2024-05-28 20:47:49 -0700
committerGitHub <noreply@github.com>2024-05-28 20:47:49 -0700
commitcbf6e93ceee7b9de2b7c3e7e8cea3a972eda0e75 (patch)
treece3fefbb7b277f63ba5c95eb9dc4bb8f3ea02c9e /clang/lib/CodeGen/CGExprAgg.cpp
parentc250aeb9d6c590d9fdbebd84fc259c4e536dace9 (diff)
downloadllvm-cbf6e93ceee7b9de2b7c3e7e8cea3a972eda0e75.zip
llvm-cbf6e93ceee7b9de2b7c3e7e8cea3a972eda0e75.tar.gz
llvm-cbf6e93ceee7b9de2b7c3e7e8cea3a972eda0e75.tar.bz2
[clang codegen] Delete unnecessary GEP cleanup code. (#90303)
There's some code in AggExprEmitter::VisitCXXParenListOrInitListExpr to try to do early cleanup for GEPs for fields that aren't accessed. But it's unlikely to actually save significant compile-time, and it's subtly wrong in cases where EmitLValueForFieldInitialization() doesn't create a GEP. So just delete the code. Fixes #88077. Fixes #89547.
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index bba0025..7a92fc3 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -1789,7 +1789,6 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
// Push a destructor if necessary.
// FIXME: if we have an array of structures, all explicitly
// initialized, we can end up pushing a linear number of cleanups.
- bool pushedCleanup = false;
if (QualType::DestructionKind dtorKind
= field->getType().isDestructedType()) {
assert(LV.isSimple());
@@ -1797,17 +1796,8 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
CGF.pushDestroyAndDeferDeactivation(NormalAndEHCleanup, LV.getAddress(),
field->getType(),
CGF.getDestroyer(dtorKind), false);
- pushedCleanup = true;
}
}
-
- // If the GEP didn't get used because of a dead zero init or something
- // else, clean it up for -O0 builds and general tidiness.
- if (!pushedCleanup && LV.isSimple())
- if (llvm::GetElementPtrInst *GEP =
- dyn_cast<llvm::GetElementPtrInst>(LV.emitRawPointer(CGF)))
- if (GEP->use_empty())
- GEP->eraseFromParent();
}
}