Skip to content

Commit 2b59ce1

Browse files
committed
skip memset
1 parent a8d3da9 commit 2b59ce1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,9 +1627,11 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
16271627
LastStore = nullptr;
16281628

16291629
// If this is a read-only or write-only call, process it. Skip store
1630-
// MemInsts, as they will be more precisely handled lateron.
1630+
// MemInsts, as they will be more precisely handled later on. Also skip
1631+
// memsets, as DSE may be able to optimize them better by removing the
1632+
// earlier rather than later store.
16311633
if (CallValue::canHandle(&Inst) &&
1632-
(!MemInst.isValid() || !MemInst.isStore())) {
1634+
(!MemInst.isValid() || !MemInst.isStore()) && !isa<MemSetInst>(&Inst)) {
16331635
// If we have an available version of this call, and if it is the right
16341636
// generation, replace this instruction.
16351637
std::pair<Instruction *, unsigned> InVal = AvailableCalls.lookup(&Inst);

0 commit comments

Comments
 (0)