41 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs2; RUN: opt -S -passes=iroutliner -ir-outlining-no-cost < %s | FileCheck %s3 4; This is a test to ensure that when the first instruction is a commutative5; instruction, but the order of operands is reversed, we pass the arguments6; in the correct order, such that we do not use the wrong arguments7; later on in the computation.8 9define void @fish(i32 %0, i32 %1, i32 %2) {10entry:11 %3 = add nsw i32 %0, %112 %4 = sub nsw i32 %1, %213 %5 = sub nsw i32 %0, %214 ret void15}16 17define void @turtle(i32 %0, i32 %1, i32 %2) {18 %4 = add nsw i32 %1, %019 %5 = sub nsw i32 %1, %220 %6 = sub nsw i32 %0, %221 ret void22}23; CHECK-LABEL: @fish(24; CHECK-NEXT: entry:25; CHECK-NEXT: call void @outlined_ir_func_0(i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]])26; CHECK-NEXT: ret void27;28;29; CHECK-LABEL: @turtle(30; CHECK-NEXT: call void @outlined_ir_func_0(i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]])31; CHECK-NEXT: ret void32;33;34; CHECK: @outlined_ir_func_0(i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]])35; CHECK: entry_to_outline:36; CHECK-NEXT: [[TMP3:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]37; CHECK-NEXT: [[TMP4:%.*]] = sub nsw i32 [[TMP1]], [[TMP2]]38; CHECK-NEXT: [[TMP5:%.*]] = sub nsw i32 [[TMP0]], [[TMP2]]39; CHECK-NEXT: br label [[ENTRY_AFTER_OUTLINE_EXITSTUB:%.*]]40;41