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

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 01:21:12 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))
----------------
nikic wrote:

FWIW, it would be legal to return a inttoptr constant for non-zero values. But not sure if it would be a good idea, so staying conservative is reasonable.

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


More information about the cfe-commits mailing list