Skip to content

Commit bdf2473

Browse files
Update Clang Codegen Test and Remove Unnecessary XORs
1 parent c74e9b6 commit bdf2473

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

clang/test/CodeGen/attr-counted-by.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ size_t test3_bdos(struct annotated *p) {
333333
// SANITIZE-WITH-ATTR-NEXT: [[COUNT50:%.*]] = sext i32 [[DOTCOUNTED_BY_LOAD44]] to i64
334334
// SANITIZE-WITH-ATTR-NEXT: [[TMP10:%.*]] = sub nsw i64 [[COUNT50]], [[IDXPROM42]]
335335
// SANITIZE-WITH-ATTR-NEXT: [[TMP11:%.*]] = tail call i64 @llvm.smax.i64(i64 [[TMP10]], i64 0)
336-
// SANITIZE-WITH-ATTR-NEXT: [[DOTTR:%.*]] = trunc nuw i64 [[TMP11]] to i32
336+
// SANITIZE-WITH-ATTR-NEXT: [[DOTTR:%.*]] = trunc nuw nsw i64 [[TMP11]] to i32
337337
// SANITIZE-WITH-ATTR-NEXT: [[CONV54:%.*]] = shl i32 [[DOTTR]], 2
338338
// SANITIZE-WITH-ATTR-NEXT: [[CONV55:%.*]] = and i32 [[CONV54]], 252
339339
// SANITIZE-WITH-ATTR-NEXT: store i32 [[CONV55]], ptr [[ARRAYIDX65]], align 4, !tbaa [[TBAA4]]

llvm/test/Transforms/CorrelatedValuePropagation/trunc.ll

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ define i1 @infer_nuw(i8 range(i8 0, 2) %A, i8 range(i8 0, 2) %B) {
77
; CHECK-SAME: i8 range(i8 0, 2) [[A:%.*]], i8 range(i8 0, 2) [[B:%.*]]) {
88
; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[B]], [[A]]
99
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw i8 [[XOR]] to i1
10-
; CHECK-NEXT: [[RESULT:%.*]] = xor i1 [[TRUNC]], true
11-
; CHECK-NEXT: ret i1 [[RESULT]]
10+
; CHECK-NEXT: ret i1 [[TRUNC]]
1211
;
1312
%xor = xor i8 %B, %A
1413
%trunc = trunc i8 %xor to i1
15-
%result = xor i1 %trunc, true
16-
ret i1 %result
14+
ret i1 %trunc
1715
}
1816

1917

@@ -35,13 +33,11 @@ define i8 @infer_nuw_nsw(i16 range(i16 -5, -3) %A, i16 range(i16 -5, -3) %B) {
3533
; CHECK-SAME: i16 range(i16 -5, -3) [[A:%.*]], i16 range(i16 -5, -3) [[B:%.*]]) {
3634
; CHECK-NEXT: [[XOR:%.*]] = xor i16 [[B]], [[A]]
3735
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw nsw i16 [[XOR]] to i8
38-
; CHECK-NEXT: [[XOR2:%.*]] = xor i8 [[TRUNC]], 1
39-
; CHECK-NEXT: ret i8 [[XOR2]]
36+
; CHECK-NEXT: ret i8 [[TRUNC]]
4037
;
4138
%xor = xor i16 %B, %A
4239
%trunc = trunc i16 %xor to i8
43-
%xor2 = xor i8 %trunc, 1
44-
ret i8 %xor2
40+
ret i8 %trunc
4541
}
4642

4743

@@ -104,11 +100,9 @@ define i1 @overdefined_range_negative(i8 %A, i8 %B) {
104100
; CHECK-SAME: i8 [[A:%.*]], i8 [[B:%.*]]) {
105101
; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[A]], [[B]]
106102
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i8 [[XOR]] to i1
107-
; CHECK-NEXT: [[XOR2:%.*]] = xor i1 [[TRUNC]], true
108-
; CHECK-NEXT: ret i1 [[XOR2]]
103+
; CHECK-NEXT: ret i1 [[TRUNC]]
109104
;
110105
%xor = xor i8 %A, %B
111106
%trunc = trunc i8 %xor to i1
112-
%xor2 = xor i1 %trunc, true
113-
ret i1 %xor2
107+
ret i1 %trunc
114108
}

0 commit comments

Comments
 (0)