1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs 2; RUN: opt -S -passes=iroutliner -ir-outlining-no-cost < %s | FileCheck %s 3 4; This is a test to ensure that when the first instruction is a commutative 5; instruction, but the order of operands is reversed, we pass the arguments 6; in the correct order, such that we do not use the wrong arguments 7; later on in the computation. 8 9define void @fish(i32 %0, i32 %1, i32 %2) { 10entry: 11 %3 = add nsw i32 %0, %1 12 %4 = sub nsw i32 %1, %2 13 %5 = sub nsw i32 %0, %2 14 ret void 15} 16 17define void @turtle(i32 %0, i32 %1, i32 %2) { 18 %4 = add nsw i32 %1, %0 19 %5 = sub nsw i32 %1, %2 20 %6 = sub nsw i32 %0, %2 21 ret void 22} 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 void 27; 28; 29; CHECK-LABEL: @turtle( 30; CHECK-NEXT: call void @outlined_ir_func_0(i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]]) 31; CHECK-NEXT: ret void 32; 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