[llvm] 82d7502 - llvm-reduce: Handle nneg flag
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 20:13:17 PST 2023
Author: Matt Arsenault
Date: 2023-12-13T11:13:09+07:00
New Revision: 82d750239e554f0c73f8db3581761fffab0292c6
URL: https://github.com/llvm/llvm-project/commit/82d750239e554f0c73f8db3581761fffab0292c6
DIFF: https://github.com/llvm/llvm-project/commit/82d750239e554f0c73f8db3581761fffab0292c6.diff
LOG: llvm-reduce: Handle nneg flag
Added:
Modified:
llvm/test/tools/llvm-reduce/reduce-flags.ll
llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-reduce/reduce-flags.ll b/llvm/test/tools/llvm-reduce/reduce-flags.ll
index 4745f98db46b1..429086effce80 100644
--- a/llvm/test/tools/llvm-reduce/reduce-flags.ll
+++ b/llvm/test/tools/llvm-reduce/reduce-flags.ll
@@ -200,3 +200,19 @@ define float @fadd_nnan_ninf_keep_nnan(float %a, float %b) {
%op = fadd nnan ninf float %a, %b
ret float %op
}
+
+; CHECK-LABEL: @zext_nneg_drop(
+; INTERESTING: = zext
+; RESULT: zext i32
+define i64 @zext_nneg_drop(i32 %a) {
+ %op = zext nneg i32 %a to i64
+ ret i64 %op
+}
+
+; CHECK-LABEL: @zext_nneg_keep(
+; INTERESTING: = zext nneg
+; RESULT: zext nneg i32
+define i64 @zext_nneg_keep(i32 %a) {
+ %op = zext nneg i32 %a to i64
+ ret i64 %op
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
index c73e74e4c25c9..96d3de01af7de 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
@@ -30,6 +30,9 @@ static void reduceFlagsInModule(Oracle &O, ReducerWorkItem &WorkItem) {
} else if (auto *PE = dyn_cast<PossiblyExactOperator>(&I)) {
if (PE->isExact() && !O.shouldKeep())
I.setIsExact(false);
+ } else if (auto *NNI = dyn_cast<PossiblyNonNegInst>(&I)) {
+ if (NNI->hasNonNeg() && !O.shouldKeep())
+ NNI->setNonNeg(false);
} else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) {
if (GEP->isInBounds() && !O.shouldKeep())
GEP->setIsInBounds(false);
More information about the llvm-commits
mailing list