Page MenuHomePhabricator

[Codegen] Remove dead flags on Physical Defs in machine cse
ClosedPublic

Authored by dmgreen on Feb 12 2019, 5:09 AM.

Details

Summary

We may leave behind incorrect dead flags on instructions that are CSE'd. Make
sure we remove the dead flags on these instructions to prevent other incorrect
code motion.

Diff Detail

Repository
rL LLVM

Event Timeline

dmgreen created this revision.Feb 12 2019, 5:09 AM
efriedma accepted this revision.Feb 19 2019, 3:32 PM

It's odd nobody has run into this before, but LGTM with minor nits.

lib/CodeGen/MachineCSE.cpp
279 ↗(On Diff #186443)

You could use llvm::enumerate here; maybe more readable. Otherwise, please use an "I < E" loop (http://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop) .

test/CodeGen/Thumb/machine-cse-deadreg.mir
1 ↗(On Diff #186443)

-verify-machine-instrs

This revision is now accepted and ready to land.Feb 19 2019, 3:32 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 20 2019, 2:23 AM