| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 |
| ; RUN: opt < %s -loop-reduce -S | FileCheck %s |
| ; RUN: opt -passes='require<scalar-evolution>,require<targetir>,loop(loop-reduce)' < %s -S | FileCheck %s |
| ; |
| ; PR11782: bad cast to AddRecExpr. |
| ; A sign extend feeds an IVUser and cannot be hoisted into the AddRec. |
| ; CollectIVChains should bailout on this case. |
| |
| |
| ; Provide legal integer types. |
| target datalayout = "n8:16:32:64" |
| |
| %struct = type { ptr, ptr, i16, i64, i16, i16, i16, i64, i64, i16, ptr, i64, i64, i64 } |
| |
| define i32 @test(ptr %h, i32 %more) nounwind uwtable { |
| ; CHECK-LABEL: define i32 @test |
| ; CHECK-SAME: (ptr [[H:%.*]], i32 [[MORE:%.*]]) #[[ATTR0:[0-9]+]] { |
| ; CHECK-NEXT: entry: |
| ; CHECK-NEXT: br i1 undef, label [[LAND_END238:%.*]], label [[RETURN:%.*]] |
| ; CHECK: land.end238: |
| ; CHECK-NEXT: br label [[FOR_BODY:%.*]] |
| ; CHECK: for.body: |
| ; CHECK-NEXT: [[LSR_IV:%.*]] = phi ptr [ [[SCEVGEP:%.*]], [[SW_EPILOG:%.*]] ], [ undef, [[LAND_END238]] ] |
| ; CHECK-NEXT: [[COLUMN_N_0:%.*]] = phi i16 [ 0, [[LAND_END238]] ], [ [[INC601:%.*]], [[SW_EPILOG]] ] |
| ; CHECK-NEXT: [[CONV250:%.*]] = sext i16 [[COLUMN_N_0]] to i32 |
| ; CHECK-NEXT: [[ADD257:%.*]] = add nsw i32 [[CONV250]], 1 |
| ; CHECK-NEXT: [[CONV258:%.*]] = trunc i32 [[ADD257]] to i16 |
| ; CHECK-NEXT: [[CMP263:%.*]] = icmp ult i16 undef, 2 |
| ; CHECK-NEXT: br label [[IF_END388:%.*]] |
| ; CHECK: if.end388: |
| ; CHECK-NEXT: [[CALL405:%.*]] = call signext i16 @SQLColAttribute(ptr undef, i16 zeroext [[CONV258]], i16 zeroext 1003, ptr null, i16 signext 0, ptr null, ptr [[LSR_IV]]) #[[ATTR1:[0-9]+]] |
| ; CHECK-NEXT: br label [[SW_EPILOG]] |
| ; CHECK: sw.epilog: |
| ; CHECK-NEXT: [[INC601]] = add i16 [[COLUMN_N_0]], 1 |
| ; CHECK-NEXT: [[SCEVGEP]] = getelementptr i8, ptr [[LSR_IV]], i64 88 |
| ; CHECK-NEXT: br label [[FOR_BODY]] |
| ; CHECK: return: |
| ; CHECK-NEXT: ret i32 1 |
| ; |
| entry: |
| br i1 undef, label %land.end238, label %return |
| |
| land.end238: ; preds = %if.end229 |
| br label %for.body |
| |
| for.body: ; preds = %sw.epilog, %land.end238 |
| %fbh.0 = phi ptr [ undef, %land.end238 ], [ %incdec.ptr, %sw.epilog ] |
| %column_n.0 = phi i16 [ 0, %land.end238 ], [ %inc601, %sw.epilog ] |
| %conv250 = sext i16 %column_n.0 to i32 |
| %add257 = add nsw i32 %conv250, 1 |
| %conv258 = trunc i32 %add257 to i16 |
| %cmp263 = icmp ult i16 undef, 2 |
| br label %if.end388 |
| |
| if.end388: ; preds = %if.then380, %if.else356 |
| %ColLength = getelementptr inbounds %struct, ptr %fbh.0, i64 0, i32 7 |
| %call405 = call signext i16 @SQLColAttribute(ptr undef, i16 zeroext %conv258, i16 zeroext 1003, ptr null, i16 signext 0, ptr null, ptr %ColLength) nounwind |
| br label %sw.epilog |
| |
| sw.epilog: ; preds = %sw.bb542, %sw.bb523, %if.end475 |
| %inc601 = add i16 %column_n.0, 1 |
| %incdec.ptr = getelementptr inbounds %struct, ptr %fbh.0, i64 1 |
| br label %for.body |
| |
| return: ; preds = %entry |
| ret i32 1 |
| } |
| |
| declare signext i16 @SQLColAttribute(ptr, i16 zeroext, i16 zeroext, ptr, i16 signext, ptr, ptr) |