mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[InstSimplify] Reorder checks to be more efficient; NFC
First check whether the RHS is a null pointer, and only then perform a potentially expensive non-zero query.
This commit is contained in:
parent
119fe7e34e
commit
a84d00a0cd
@ -2340,10 +2340,9 @@ computePointerICmp(const DataLayout &DL, const TargetLibraryInfo *TLI,
|
||||
RHS = RHS->stripPointerCasts();
|
||||
|
||||
// A non-null pointer is not equal to a null pointer.
|
||||
if (llvm::isKnownNonZero(LHS, DL, 0, nullptr, nullptr, nullptr,
|
||||
IIQ.UseInstrInfo) &&
|
||||
isa<ConstantPointerNull>(RHS) &&
|
||||
(Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE))
|
||||
if (isa<ConstantPointerNull>(RHS) && ICmpInst::isEquality(Pred) &&
|
||||
llvm::isKnownNonZero(LHS, DL, 0, nullptr, nullptr, nullptr,
|
||||
IIQ.UseInstrInfo))
|
||||
return ConstantInt::get(GetCompareTy(LHS),
|
||||
!CmpInst::isTrueWhenEqual(Pred));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user