[llvm] r355291 - Add extra ops in add to sub transform test in order to enforce proper operand ordering. NFC
Amaury Sechet via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 07:11:14 PST 2019
Author: deadalnix
Date: Sun Mar 3 07:11:13 2019
New Revision: 355291
URL: http://llvm.org/viewvc/llvm-project?rev=355291&view=rev
Log:
Add extra ops in add to sub transform test in order to enforce proper operand ordering. NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/add.ll
Modified: llvm/trunk/test/Transforms/InstCombine/add.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/add.ll?rev=355291&r1=355290&r2=355291&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/add.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/add.ll Sun Mar 3 07:11:13 2019
@@ -948,13 +948,15 @@ define i32 @add_not_increment_commuted(i
}
; E = (A + ~B) + 1 = A - B
-define i32 @add_to_sub(i32 %A, i32 %B) {
+define i32 @add_to_sub(i32 %M, i32 %B) {
; CHECK-LABEL: @add_to_sub(
+; CHECK-NEXT: [[A:%.*]] = mul i32 [[M:%.*]], 42
; CHECK-NEXT: [[C:%.*]] = xor i32 [[B:%.*]], -1
-; CHECK-NEXT: [[D:%.*]] = add i32 [[C]], [[A:%.*]]
+; CHECK-NEXT: [[D:%.*]] = add i32 [[A]], [[C]]
; CHECK-NEXT: [[E:%.*]] = add i32 [[D]], 1
; CHECK-NEXT: ret i32 [[E]]
;
+ %A = mul i32 %M, 42 ; thwart complexity-based ordering
%C = xor i32 %B, -1
%D = add i32 %A, %C
%E = add i32 %D, 1
@@ -962,13 +964,15 @@ define i32 @add_to_sub(i32 %A, i32 %B) {
}
; E = (~B + A) + 1 = A - B
-define i32 @add_to_sub2(i32 %A, i32 %B) {
+define i32 @add_to_sub2(i32 %A, i32 %M) {
; CHECK-LABEL: @add_to_sub2(
-; CHECK-NEXT: [[C:%.*]] = xor i32 [[B:%.*]], -1
+; CHECK-NEXT: [[B:%.*]] = mul i32 [[M:%.*]], 42
+; CHECK-NEXT: [[C:%.*]] = xor i32 [[B]], -1
; CHECK-NEXT: [[D:%.*]] = add i32 [[C]], [[A:%.*]]
; CHECK-NEXT: [[E:%.*]] = add i32 [[D]], 1
; CHECK-NEXT: ret i32 [[E]]
;
+ %B = mul i32 %M, 42 ; thwart complexity-based ordering
%C = xor i32 %B, -1
%D = add i32 %C, %A
%E = add i32 %D, 1
More information about the llvm-commits
mailing list