[llvm] r365971 - isBytewiseValue checks ConstantVector element by element
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 15:37:56 PDT 2019
Author: vitalybuka
Date: Fri Jul 12 15:37:55 2019
New Revision: 365971
URL: http://llvm.org/viewvc/llvm-project?rev=365971&view=rev
Log:
isBytewiseValue checks ConstantVector element by element
Summary: Vector of the same value with few undefs will sill be considered "Bytewise"
Reviewers: eugenis, pcc, jfb
Reviewed By: jfb
Subscribers: dexonsmith, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64031
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=365971&r1=365970&r2=365971&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Jul 12 15:37:55 2019
@@ -3253,12 +3253,7 @@ Value *llvm::isBytewiseValue(Value *V, c
return Val;
}
- if (isa<ConstantVector>(C)) {
- Constant *Splat = cast<ConstantVector>(C)->getSplatValue();
- return Splat ? isBytewiseValue(Splat, DL) : nullptr;
- }
-
- if (isa<ConstantArray>(C) || isa<ConstantStruct>(C)) {
+ if (isa<ConstantAggregate>(C)) {
Value *Val = UndefInt8;
for (unsigned I = 0, E = C->getNumOperands(); I != E; ++I)
if (!(Val = Merge(Val, isBytewiseValue(C->getOperand(I), DL))))
Modified: llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp?rev=365971&r1=365970&r2=365971&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp Fri Jul 12 15:37:55 2019
@@ -878,7 +878,7 @@ const std::pair<const char *, const char
"<4 x i8> <i8 1, i8 1, i8 2, i8 1>",
},
{
- "",
+ "i8 5",
"<2 x i8> < i8 5, i8 undef >",
},
{
More information about the llvm-commits
mailing list