This reverts commit 73ece231ee0cf048d56841f47915beb1db6afc26 and reapplies 7bfcdbcbf368cea14a5236080af975d5878a46eb with mlir changes. Also reverts commit 423ba12971bac8397c87fcf975ba6a4b7530ed28 and includes the unit test changes of 16da2140045808b2aea1d28366ca7d326eb3c809.