add BT pattern to optimizer
add test case for BT patterns
Merge pull request #1483 from WalterBright/b8

add BT pattern to optimizer