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

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 08:58:30 PDT 2023


================
@@ -984,7 +1041,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
 
   // If the client is only demanding bits that we know, return the known
   // constant.
-  if (DemandedMask.isSubsetOf(Known.Zero|Known.One))
+  if (MaySimplifyAsConstant && DemandedMask.isSubsetOf(Known.Zero | Known.One))
----------------
goldsteinn wrote:

Ill add that as a todo. Although maybe indicative we want to the flag to be based on the exact intrin as opposed to `isPointer` as different intrins may have different preference. For `@llvm.ptrmask` for example. we can easily represent the most common constant (`null`) by just zeroing the mask so there isn't much benefit to constant return. But for other intrins might be different.

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


More information about the cfe-commits mailing list