[PATCH] D104049: [AMDGPU] [CodeGen] Fold negate llvm.amdgcn.class into test mask

Anshil Gandhi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 13:11:14 PDT 2021


gandhi21299 added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp:831-839
+    if (isa<CallInst>(LHS) && isa<ConstantInt>(RHS) &&
+        cast<ConstantInt>(RHS)->getSExtValue() == -1)
+      Call = cast<CallInst>(LHS);
+    else if (isa<CallInst>(RHS) && isa<ConstantInt>(LHS) &&
+             cast<ConstantInt>(LHS)->getSExtValue() == -1)
+      Call = cast<CallInst>(RHS);
+    else {
----------------
arsenm wrote:
> arsenm wrote:
> > I believe PatternMatch has a nicer way to check for a not
> Plus constants are canonicalized to the RHS, so you don't need to check both
After removing the else-if condition, this seems clean enough to me. Perhaps, PatternMatch won't be required any more.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104049



More information about the llvm-commits mailing list