[FIX] Fix potential issue related to subtraction from an unsigned 0 in circularShiftOutputDims

Reported-by: Mehdi Amini <mehdi.amini@apple.com>
Contributed-by: Michael Kruse <llvm@meinersbur.de>

Differential Revision: http://reviews.llvm.org/D20969

llvm-svn: 271705
This commit is contained in:
Roman Gareev 2016-06-03 18:46:29 +00:00
parent dfec58e80c
commit 4b8c7aeb62
1 changed files with 3 additions and 1 deletions

View File

@ -463,8 +463,10 @@ static bool containsMatrMult(__isl_keep isl_map *PartialSchedule) {
///
/// @param IslMap The isl map to be modified.
static __isl_give isl_map *circularShiftOutputDims(__isl_take isl_map *IslMap) {
auto InputDimsId = isl_map_get_tuple_id(IslMap, isl_dim_in);
auto DimNum = isl_map_dim(IslMap, isl_dim_out);
if (DimNum == 0)
return IslMap;
auto InputDimsId = isl_map_get_tuple_id(IslMap, isl_dim_in);
IslMap = isl_map_move_dims(IslMap, isl_dim_in, 0, isl_dim_out, DimNum - 1, 1);
IslMap = isl_map_move_dims(IslMap, isl_dim_out, 0, isl_dim_in, 0, 1);
return isl_map_set_tuple_id(IslMap, isl_dim_in, InputDimsId);