diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp b/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp index 248ef6c23974..83b8c2d0eacb 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp @@ -365,7 +365,13 @@ static bool CanGenerateTest(Loop *L, Value *Count) { return false; }; - if (!IsCompareZero(ICmp, Count, 0) && !IsCompareZero(ICmp, Count, 1)) + // Check if Count is a zext. + Value *CountBefZext = + isa<ZExtInst>(Count) ? cast<ZExtInst>(Count)->getOperand(0) : nullptr; + + if (!IsCompareZero(ICmp, Count, 0) && !IsCompareZero(ICmp, Count, 1) && + !IsCompareZero(ICmp, CountBefZext, 0) && + !IsCompareZero(ICmp, CountBefZext, 1)) return false; unsigned SuccIdx = ICmp->getPredicate() == ICmpInst::ICMP_NE ? 0 : 1; |
