[llvm] 8c46881 - [TTI] Recognize fp constants in getOperandInfo
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 14:34:50 PDT 2022
Author: Philip Reames
Date: 2022-09-21T14:34:34-07:00
New Revision: 8c46881a5386ebbe273d15d6a9d369885c2460a9
URL: https://github.com/llvm/llvm-project/commit/8c46881a5386ebbe273d15d6a9d369885c2460a9
DIFF: https://github.com/llvm/llvm-project/commit/8c46881a5386ebbe273d15d6a9d369885c2460a9.diff
LOG: [TTI] Recognize fp constants in getOperandInfo
We were recognizing vectors of floats, but not scalars. That's a tad odd.
Added:
Modified:
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/test/Transforms/LoopVectorize/X86/pointer-runtime-checks-unprofitable.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index d009f2fc0bdd0..1d0b31e065956 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -726,9 +726,10 @@ TargetTransformInfo::getOperandInfo(const Value *V) {
OperandValueKind OpInfo = OK_AnyValue;
OperandValueProperties OpProps = OP_None;
- if (const auto *CI = dyn_cast<ConstantInt>(V)) {
- if (CI->getValue().isPowerOf2())
- OpProps = OP_PowerOf2;
+ if (isa<ConstantInt>(V) || isa<ConstantFP>(V)) {
+ if (const auto *CI = dyn_cast<ConstantInt>(V))
+ if (CI->getValue().isPowerOf2())
+ OpProps = OP_PowerOf2;
return {OK_UniformConstantValue, OpProps};
}
diff --git a/llvm/test/Transforms/LoopVectorize/X86/pointer-runtime-checks-unprofitable.ll b/llvm/test/Transforms/LoopVectorize/X86/pointer-runtime-checks-unprofitable.ll
index 09d5fe5f05a3a..96fff3c1432f4 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/pointer-runtime-checks-unprofitable.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/pointer-runtime-checks-unprofitable.ll
@@ -59,7 +59,7 @@ define void @test(double* nocapture %A, double* nocapture %B, double* nocapture
; CHECK-NEXT: 1 for {{.+}} = or i1
; CHECK-NEXT: Total cost of runtime checks: 35
-; CHECK: LV: Vectorization is not beneficial: expected trip count < minimum profitable VF (16 < 70)
+; CHECK: LV: Vectorization is not beneficial: expected trip count < minimum profitable VF (16 < 24)
;
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
More information about the llvm-commits
mailing list