[llvm] [X86] Use getAllOnesConstant instead of getConstant(-1). NFC (PR #114299)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 13:27:31 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/114299
A while back I had tried to clean up cases where getConstant was implicitly truncating constants. Initially by manual audit and later with an assert. I only committed patches from the assert testing.
This code path isn't executed in lit tests so I only found it with the manual audit. This patch was still sitting in my stash so thought I go ahead and post it.
>From 1481ae360dcf61a4687d455018076120e7d12057 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 30 Oct 2024 13:22:16 -0700
Subject: [PATCH] [X86] Use getAllOnesConstant instead of getConstant(-1). NFCI
A while back I had tried to cleanup cases where getConstant was
implicitly truncating constants. Initially by manual audit and later
with an assert. I only committed patches from the assert testing.
This code path isn't executed in lit tests so I only found it with
the manual audit. I found this patch still setting in my stash so
thought I go ahead and post it.
---
llvm/lib/Target/X86/X86ISelLowering.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 34bc5d76c15cea..22cba69af41f51 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -49321,7 +49321,7 @@ static SDValue combineVectorShiftImm(SDNode *N, SelectionDAG &DAG,
if (!LogicalShift && ISD::isBuildVectorAllOnes(N0.getNode()))
// N0 is all ones or undef. We guarantee that the bits shifted into the
// result are all ones, not undef.
- return DAG.getConstant(-1, SDLoc(N), VT);
+ return DAG.getAllOnesConstant(SDLoc(N), VT);
auto MergeShifts = [&](SDValue X, uint64_t Amt0, uint64_t Amt1) {
unsigned NewShiftVal = Amt0 + Amt1;
More information about the llvm-commits
mailing list