[llvm] aa60d16 - [CVP] Add a cl::opt for canonicalization of signed relational comparisons
Artur Pilipenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 24 13:52:45 PST 2021
Author: Artur Pilipenko
Date: 2021-11-24T13:52:38-08:00
New Revision: aa60d169ea62ee375910e684d20932519fe3f64f
URL: https://github.com/llvm/llvm-project/commit/aa60d169ea62ee375910e684d20932519fe3f64f
DIFF: https://github.com/llvm/llvm-project/commit/aa60d169ea62ee375910e684d20932519fe3f64f.diff
LOG: [CVP] Add a cl::opt for canonicalization of signed relational comparisons
This canonicalization breaks the ability to discard checks in some cases.
Add a command line option to disable it. This option is on by default,
so the change is NFC.
See for details:
https://reviews.llvm.org/D112895#3149487
Added:
Modified:
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index d1ae35cc17ab2..6d6097c9ece10 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -52,6 +52,11 @@ using namespace llvm;
#define DEBUG_TYPE "correlated-value-propagation"
+static cl::opt<bool> CanonicalizeICmpPredicatesToUnsigned(
+ "canonicalize-icmp-predicates-to-unsigned", cl::init(true), cl::Hidden,
+ cl::desc("Enables canonicalization of signed relational predicates to "
+ "unsigned (e.g. sgt => ugt)"));
+
STATISTIC(NumPhis, "Number of phis propagated");
STATISTIC(NumPhiCommon, "Number of phis deleted via common incoming value");
STATISTIC(NumSelects, "Number of selects propagated");
@@ -297,6 +302,9 @@ static bool processMemAccess(Instruction *I, LazyValueInfo *LVI) {
}
static bool processICmp(ICmpInst *Cmp, LazyValueInfo *LVI) {
+ if (!CanonicalizeICmpPredicatesToUnsigned)
+ return false;
+
// Only for signed relational comparisons of scalar integers.
if (Cmp->getType()->isVectorTy() ||
!Cmp->getOperand(0)->getType()->isIntegerTy())
More information about the llvm-commits
mailing list