diff options
author | Nikita Popov <npopov@redhat.com> | 2024-06-06 09:39:33 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2024-06-06 09:39:33 +0200 |
commit | 16e2ec82ac45701f9c55ab917e30f38dbae6f79a (patch) | |
tree | a5b4b893d7bfe253029f2b7bff0563051e597640 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 9bea770b63861250c8bbec46f68df73da4f09508 (diff) | |
download | llvm-16e2ec82ac45701f9c55ab917e30f38dbae6f79a.zip llvm-16e2ec82ac45701f9c55ab917e30f38dbae6f79a.tar.gz llvm-16e2ec82ac45701f9c55ab917e30f38dbae6f79a.tar.bz2 |
[ValueTracking] Make undef element check more precise
If we're only checking for undef, then also only look for undef
elements in the vector (rather than undef and poison).
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 08138a5..782c28c 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -7296,10 +7296,13 @@ static bool isGuaranteedNotToBeUndefOrPoison( isa<ConstantPointerNull>(C) || isa<Function>(C)) return true; - if (C->getType()->isVectorTy() && !isa<ConstantExpr>(C)) - return (!includesUndef(Kind) ? !C->containsPoisonElement() - : !C->containsUndefOrPoisonElement()) && - !C->containsConstantExpression(); + if (C->getType()->isVectorTy() && !isa<ConstantExpr>(C)) { + if (includesUndef(Kind) && C->containsUndefElement()) + return false; + if (includesPoison(Kind) && C->containsPoisonElement()) + return false; + return !C->containsConstantExpression(); + } } // Strip cast operations from a pointer value. |