[llvm-commits] [Review request] Recursively delete trivially dead conditions of constant folded terminators.

Frits van Bommel fvbommel at gmail.com
Wed Mar 9 14:39:42 PST 2011

The attached patch adds a parameter to ConstantFoldTerminator() that
callers can use to ask it to also clean up the condition of any
conditional terminator it folds to be unconditional, if that turns the
condition into dead code. This just means it calls
RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It
defaults to the old behavior.

I also changed -simplifycfg and -jump-threading to use this to produce
slightly better code without any extra cleanup passes (AFAICT this was
the only place in -simplifycfg where now-dead conditions of replaced
terminators weren't being cleaned up).
The only other user of this function is -sccp, but I didn't read that
thoroughly enough to figure out whether it might be holding pointers
to instructions that could be deleted by this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: constantfoldterminator-dce-dead-cond.patch
Type: text/x-patch
Size: 6265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110309/8981764f/attachment.bin>

More information about the llvm-commits mailing list