[ConstraintElimination] Remove dead variables when dropping constraints.
authorFlorian Hahn <flo@fhahn.com>
Mon, 7 Mar 2022 09:03:48 +0000 (09:03 +0000)
committerFlorian Hahn <flo@fhahn.com>
Mon, 7 Mar 2022 09:04:07 +0000 (09:04 +0000)
commit542c335159d45f4650383a2bdfb337d9f9b4d1f1
treeef166ea59d406c616a0a703f73bf27428e8dcd7a
parent4ad1ed3a2ea9c25b2a69a560c22ee09961b5248a
[ConstraintElimination] Remove dead variables when dropping constraints.

This patch extends ConstraintElimination to also remove dead variables
when removing a constraint. When a constraint is removed because it is
out of scope, all new variables added for this constraint can also be
removed.

This keeps the total size of the systems much smaller, because it
reduces the number of variables drastically.

It also fixes a bug where variables where removed incorrectly.

Fixes https://github.com/llvm/llvm-project/issues/54228
llvm/include/llvm/Analysis/ConstraintSystem.h
llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
llvm/test/Transforms/ConstraintElimination/pr54228-variable-name-order.ll