================
@@ -10211,8 +10210,18 @@ bool AANoUndef::isImpliedByIR(Attributor &A, const 
IRPosition &IRP,
     return true;
 
   Value &Val = IRP.getAssociatedValue();
+  auto IsTargetGuaranteedNotPoison = [&](Value &V) {
+    if (auto *ASC = dyn_cast<AddrSpaceCastInst>(&V)) {
+      const auto *TTI = A.getInfoCache().getTargetTransformInfoForFunction(
+          *ASC->getFunction());
+      return ASC && TTI->isValidAddrSpaceCast(ASC->getSrcAddressSpace(),
+                                              ASC->getDestAddressSpace());
+    }
+    return false;
+  };
   if (IRP.getPositionKind() != IRPosition::IRP_RETURNED &&
-      isGuaranteedNotToBeUndefOrPoison(&Val)) {
+      (isGuaranteedNotToBeUndefOrPoison(&Val) ||
+       IsTargetGuaranteedNotPoison(Val))) {
----------------
nikic wrote:

This is incorrect, it will not handle poison introduced higher up the chain if 
it ends in an addrspacecast. It's also sub-optimal, because it will not handle 
known-valid addrspacecasts higher up the chain. This needs to be handled fully 
inside canCreateUndefOrPoison.

https://github.com/llvm/llvm-project/pull/144686
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to