The checks only checked if the operands were either valid dims and symbols without checking which ones should be valid dims and which should be valid symbols. The necessary methods to check already existed. With this fix, for some existing tests, it leads to a more accurate error message. In other cases, invalid IRs are caught as shown in the test case added. Related to: https://github.com/llvm/llvm-project/issues/120189