[PATCH] D109631: [HardwareLoops] Loop guard intrinsic to recognise zext

Sherwin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 08:09:27 PDT 2021


sherwin-dc added inline comments.


================
Comment at: llvm/lib/CodeGen/HardwareLoops.cpp:369
+  // Check if Count is a zext.
+  Value *CountBefZext =
+      isa<ZExtInst>(Count) ? cast<ZExtInst>(Count)->getOperand(0) : nullptr;
----------------
samparker wrote:
> Can we use SCEV isLoopEntryGuardedByCond instead of doing the pattern matching? It feels like we should be able to replace IsCompareZero with it which would remove the need to do an explicit zext check. 
It seems that isLoopEntryGuardedByCond is already used just before this (see below comment). This was added at the same time as IsCompareZero in D63809, so I'm not sure if IsCompareZero was needed in some way to explicitly check the instructions.


================
Comment at: llvm/lib/CodeGen/HardwareLoops.cpp:395-396
   // the loop header, so also check if it has a single predecessor.
   if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, TripCount,
                                   SE.getZero(TripCount->getType()))) {
     LLVM_DEBUG(dbgs() << " - Attempting to use test.set counter.\n");
----------------
isLoopEntryGuardedByCond used here


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109631/new/

https://reviews.llvm.org/D109631



More information about the llvm-commits mailing list