Moved redundant validation code to a separate function
Moved redundant validation code to a separate function


Former-commit-id: 8d0b325ee348fe8cf4ef9c48f71e8d8a6fa9ef85
Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide