[PATCH] D150142: [InstCombine] Add simplifications for div/rem with `i1` operands; PR62607
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 00:56:51 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1133-1137
// X / 1 -> X
// X % 1 -> 0
// If the divisor can only be zero or one, we can't have division-by-zero
// or remainder-by-zero, so assume the divisor is 1.
// e.g. 1, zext (i8 X), sdiv X (Y and 1)
----------------
Move this comment to the if below now?
================
Comment at: llvm/test/Transforms/InstCombine/div-i1.ll:16
+true:
+ %y_true = and i1 %y, 0
+ br label %done
----------------
Is there a more robust way to test this that doesn't rely on worklist order bugs? Something like an assume to zero in an instsimplify test? Or does that also get simplified early?
================
Comment at: llvm/test/Transforms/InstCombine/pr62607.ll:6
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
----------------
Remove triple.
================
Comment at: llvm/test/Transforms/InstCombine/pr62607.ll:86
+ br label %bb_6
+}
----------------
Is this already a minimal reduction per llvm-reduce?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150142/new/
https://reviews.llvm.org/D150142
More information about the llvm-commits
mailing list