[clang] [InstCombine] Add combines/simplifications for `llvm.ptrmask` (PR #67166)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 24 07:13:59 PDT 2023


================
@@ -6397,6 +6397,48 @@ static Value *simplifyBinaryIntrinsic(Function *F, Value *Op0, Value *Op1,
       return Constant::getNullValue(ReturnType);
     break;
   }
+  case Intrinsic::ptrmask: {
+    // Fail loudly in case this is ever changed.
+    // TODO: If vector types are supported the logic that checks if the mask is
+    // useless should be updated to use generic constants.
+    assert(!Op0->getType()->isVectorTy() && !Op1->getType()->isVectorTy() &&
+           "These simplifications where written at a time when ptrmask did not "
+           "support vector types and may not work for vectors");
----------------
goldsteinn wrote:

I guess my feeling is since its untested, we shouldn't assume it works. Seems lower cost to just delete these lines when/if adding vec support than to potentially leave buggy codes.

https://github.com/llvm/llvm-project/pull/67166


More information about the cfe-commits mailing list