194 changes: 97 additions & 97 deletions llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions llvm/test/tools/llvm-reduce/reduce-flags.ll
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,35 @@ define i32 @or_disjoint_keep(i32 %a, i32 %b) {
%op = or disjoint i32 %a, %b
ret i32 %op
}

; CHECK-LABEL: @trunc_nuw_drop(
; INTERESTING: = trunc
; RESULT: trunc i64
define i32 @trunc_nuw_drop(i64 %a) {
%op = trunc nuw i64 %a to i32
ret i32 %op
}

; CHECK-LABEL: @trunc_nuw_keep(
; INTERESTING: = trunc nuw
; RESULT: trunc nuw i64
define i32 @trunc_nuw_keep(i64 %a) {
%op = trunc nuw i64 %a to i32
ret i32 %op
}

; CHECK-LABEL: @trunc_nsw_drop(
; INTERESTING: = trunc
; RESULT: trunc i64
define i32 @trunc_nsw_drop(i64 %a) {
%op = trunc nsw i64 %a to i32
ret i32 %op
}

; CHECK-LABEL: @trunc_nsw_keep(
; INTERESTING: = trunc nsw
; RESULT: trunc nsw i64
define i32 @trunc_nsw_keep(i64 %a) {
%op = trunc nsw i64 %a to i32
ret i32 %op
}
5 changes: 5 additions & 0 deletions llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ static void reduceFlagsInModule(Oracle &O, ReducerWorkItem &WorkItem) {
I.setHasNoSignedWrap(false);
if (OBO->hasNoUnsignedWrap() && !O.shouldKeep())
I.setHasNoUnsignedWrap(false);
} else if (auto *Trunc = dyn_cast<TruncInst>(&I)) {
if (Trunc->hasNoSignedWrap() && !O.shouldKeep())
Trunc->setHasNoSignedWrap(false);
if (Trunc->hasNoUnsignedWrap() && !O.shouldKeep())
Trunc->setHasNoUnsignedWrap(false);
} else if (auto *PE = dyn_cast<PossiblyExactOperator>(&I)) {
if (PE->isExact() && !O.shouldKeep())
I.setIsExact(false);
Expand Down