Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

not folding away two equivalent BBs #1392

Open Quuxplusone opened 15 years ago

Quuxplusone commented 15 years ago
Bugzilla Link PR4435
Status NEW
Importance P normal
Reported by Nick Lewycky (nlewycky@google.com)
Reported on 2009-06-23 15:21:08 -0700
Last modified on 2012-09-24 06:25:04 -0700
Version trunk
Hardware PC Linux
CC clattner@nondot.org, collinwinter@google.com, devang.patel@gmail.com, dsaritz@gmail.com, evan.cheng@apple.com, jyasskin@google.com, llvm-bugs@lists.llvm.org, wendling@apple.com
Fixed by commit(s)
Attachments b.ll (530 bytes, text/plain)
Blocks
Blocked by
See also

The attached hand-written .ll file contains four BBs in an if-statement diamond. The %cond_true and %cond_false blocks are both very similar; all instructions are the same except for the parameter of the GEP which is the same type in either case. The optimization I'd like to see is that one change being folded away into a phi node and then the blocks getting merged into the %done block.

This is very similar to an optimization simplify-cfg does, and is also an example of partial redundancy elimination and instruction sinking. Where should this optimization belong?

Quuxplusone commented 15 years ago

Attached b.ll (530 bytes, text/plain): testcase

Quuxplusone commented 15 years ago

The first step to do this is to make simplifycfg not duplicate the return into the predecessor blocks.