[PATCH] D156635: [InstCombine] Make combines on `llvm.ptrmask` fail loudly if we have vec types; NFC

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 30 16:01:05 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, RKSimon.
Herald added subscribers: StephenFan, hiraditya, arichardson.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently vec types are unsupported by `llvm.ptrmask`. Should this
change its probably better to fail loudly rather hope the code ends up
working properly for vec types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156635

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp


Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1930,6 +1930,15 @@
     break;
   }
   case Intrinsic::ptrmask: {
+    Value *Op0 = II->getArgOperand(0);
+    Value *Op1 = II->getArgOperand(1);
+    // Fail loudly in case this is ever changed.
+    // TODO: If vector types are supported the merging of (ptrmask (ptrmask))
+    // need to ensure we don't merge a vectype with non-vec type.
+    assert(!Op0->getType()->isVectorTy() && !Op1->getType()->isVectorTy() &&
+           "These combines where written at a time when ptrmask did not "
+           "support vector types and may not work for vectors");
+
     Value *InnerPtr, *InnerMask;
     if (match(II->getArgOperand(0),
               m_OneUse(m_Intrinsic<Intrinsic::ptrmask>(m_Value(InnerPtr),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156635.545479.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230730/cd96034d/attachment.bin>


More information about the llvm-commits mailing list