https://github.com/wenju-he updated 
https://github.com/llvm/llvm-project/pull/144686

>From b5c9a4834accbac18664f1431acc5204c0527fa8 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Wed, 18 Jun 2025 14:21:09 +0200
Subject: [PATCH 1/4] [InstCombine] Don't folder select to or if value argument
 is user of invalid addrspacecast inst

In our downstream GPU target, following IR is valid before instcombine
although the second addrspacecast causes UB.
  define i1 @test(ptr addrspace(1) noundef %v) {
    %0 = addrspacecast ptr addrspace(1) %v to ptr addrspace(4)
    %1 = call i32 @llvm.xxxx.isaddr.shared(ptr addrspace(4) %0)
    %2 = icmp eq i32 %1, 0
    %3 = addrspacecast ptr addrspace(4) %0 to ptr addrspace(3)
    %4 = select i1 %2, ptr addrspace(3) null, ptr addrspace(3) %3
    %5 = icmp eq ptr addrspace(3) %4, null
    ret i1 %5
  }
We have a custom optimization that replaces invalid addrspacecast with
poison, and IR is still valid since `select` stops poison propagation.

However, instcombine pass optimizes `select` to `or`:
    %0 = addrspacecast ptr addrspace(1) %v to ptr addrspace(4)
    %1 = call i32 @llvm.xxxx.isaddr.shared(ptr addrspace(4) %0)
    %2 = icmp eq i32 %1, 0
    %3 = addrspacecast ptr addrspace(1) %v to ptr addrspace(3)
    %4 = icmp eq ptr addrspace(3) %3, null
    %5 = or i1 %2, %4
    ret i1 %5
The transform is invalid for our target.
---
 .../InstCombine/InstCombineSelect.cpp         | 35 +++++++++++++++----
 .../InstCombine/AMDGPU/addrspacecast.ll       | 23 ++++++++++++
 2 files changed, 52 insertions(+), 6 deletions(-)
 create mode 100644 llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 73ba0f78e8053..a2335640f917b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -3194,8 +3194,23 @@ static Instruction *foldNestedSelects(SelectInst 
&OuterSelVal,
 /// Return true if V is poison or \p Expected given that ValAssumedPoison is
 /// already poison. For example, if ValAssumedPoison is `icmp samesign X, 10`
 /// and V is `icmp ne X, 5`, impliesPoisonOrCond returns true.
-static bool impliesPoisonOrCond(const Value *ValAssumedPoison, const Value *V,
-                                bool Expected) {
+static bool impliesPoisonOrCond(
+    const Value *ValAssumedPoison, const Value *V, bool Expected,
+    llvm::function_ref<bool(unsigned, unsigned)> isValidAddrSpaceCast) {
+  // Handle the case that ValAssumedPoison is `icmp eq ptr addrspace(3) X, 
null`
+  // and X is `addrspacecast ptr addrspace(1) Y to ptr addrspace(3)`. Target 
can
+  // replace X with poison if the addrspacecast is invalid. However, `V` might
+  // not be poison.
+  if (auto *ICmp = dyn_cast<ICmpInst>(ValAssumedPoison)) {
+    auto CanCreatePoison = [&](Value *Op) {
+      auto *ASC = dyn_cast<AddrSpaceCastInst>(Op);
+      return ASC && !isValidAddrSpaceCast(ASC->getDestAddressSpace(),
+                                          ASC->getSrcAddressSpace());
+    };
+    if (llvm::any_of(ICmp->operands(), CanCreatePoison))
+      return false;
+  }
+
   if (impliesPoison(ValAssumedPoison, V))
     return true;
 
@@ -3241,17 +3256,23 @@ Instruction 
*InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
   auto *Zero = ConstantInt::getFalse(SelType);
   Value *A, *B, *C, *D;
 
+  auto IsValidAddrSpaceCast = [&](unsigned FromAS, unsigned ToAS) {
+    return isValidAddrSpaceCast(FromAS, ToAS);
+  };
+
   // Folding select to and/or i1 isn't poison safe in general. impliesPoison
   // checks whether folding it does not convert a well-defined value into
   // poison.
   if (match(TrueVal, m_One())) {
-    if (impliesPoisonOrCond(FalseVal, CondVal, /*Expected=*/false)) {
+    if (impliesPoisonOrCond(FalseVal, CondVal, /*Expected=*/false,
+                            IsValidAddrSpaceCast)) {
       // Change: A = select B, true, C --> A = or B, C
       return BinaryOperator::CreateOr(CondVal, FalseVal);
     }
 
     if (match(CondVal, m_OneUse(m_Select(m_Value(A), m_One(), m_Value(B)))) &&
-        impliesPoisonOrCond(FalseVal, B, /*Expected=*/false)) {
+        impliesPoisonOrCond(FalseVal, B, /*Expected=*/false,
+                            IsValidAddrSpaceCast)) {
       // (A || B) || C --> A || (B | C)
       return replaceInstUsesWith(
           SI, Builder.CreateLogicalOr(A, Builder.CreateOr(B, FalseVal)));
@@ -3287,13 +3308,15 @@ Instruction 
*InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
   }
 
   if (match(FalseVal, m_Zero())) {
-    if (impliesPoisonOrCond(TrueVal, CondVal, /*Expected=*/true)) {
+    if (impliesPoisonOrCond(TrueVal, CondVal, /*Expected=*/true,
+                            IsValidAddrSpaceCast)) {
       // Change: A = select B, C, false --> A = and B, C
       return BinaryOperator::CreateAnd(CondVal, TrueVal);
     }
 
     if (match(CondVal, m_OneUse(m_Select(m_Value(A), m_Value(B), m_Zero()))) &&
-        impliesPoisonOrCond(TrueVal, B, /*Expected=*/true)) {
+        impliesPoisonOrCond(TrueVal, B, /*Expected=*/true,
+                            IsValidAddrSpaceCast)) {
       // (A && B) && C --> A && (B & C)
       return replaceInstUsesWith(
           SI, Builder.CreateLogicalAnd(A, Builder.CreateAnd(B, TrueVal)));
diff --git a/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll 
b/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll
new file mode 100644
index 0000000000000..4791d2c434884
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll
@@ -0,0 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=instcombine %s | FileCheck %s
+
+; Check that `select B, true, C` isn't optimized to `or B, C`.
+define i1 @not_fold_select(ptr addrspace(1) noundef %x) {
+; CHECK-LABEL: define i1 @not_fold_select(
+; CHECK-SAME: ptr addrspace(1) noundef [[X:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[X]] to ptr
+; CHECK-NEXT:    [[TMP1:%.*]] = tail call i1 @llvm.amdgcn.is.shared(ptr 
[[TMP0]])
+; CHECK-NEXT:    [[TMP2:%.*]] = addrspacecast ptr addrspace(1) [[X]] to ptr 
addrspace(3)
+; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq ptr addrspace(3) [[TMP2]], null
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP1]], i1 true, i1 [[TMP3]]
+; CHECK-NEXT:    ret i1 [[TMP4]]
+;
+  entry:
+  %0 = addrspacecast ptr addrspace(1) %x to ptr
+  %1 = tail call i1 @llvm.amdgcn.is.shared(ptr %0)
+  %2 = addrspacecast ptr %0 to ptr addrspace(3)
+  %3 = select i1 %1, ptr addrspace(3) null, ptr addrspace(3) %2
+  %4 = icmp eq ptr addrspace(3) %3, null
+  ret i1 %4
+}

>From ffff2c3624239c1290e71abcce44f3317aab597a Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Thu, 19 Jun 2025 04:39:06 +0200
Subject: [PATCH 2/4] update LangRef, refine test

---
 llvm/docs/LangRef.rst                             |  3 +++
 .../Transforms/InstCombine/InstCombineSelect.cpp  |  2 +-
 .../InstCombine/AMDGPU/addrspacecast.ll           | 15 ++++++++-------
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cc72a37f68599..51d28d6215f3a 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -12621,6 +12621,9 @@ have no side effects, and must not capture the value of 
the pointer.
 If the source is :ref:`poison <poisonvalues>`, the result is
 :ref:`poison <poisonvalues>`.
 
+If the source is not :ref:`poison <poisonvalues>`, and the result pointer is
+non-dereferenceable, the result is :ref:`poison <poisonvalues>`.
+
 If the source is not :ref:`poison <poisonvalues>`, and both source and
 destination are :ref:`integral pointers <nointptrtype>`, and the
 result pointer is dereferenceable, the cast is assumed to be
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index a2335640f917b..c470362ba75d4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -3196,7 +3196,7 @@ static Instruction *foldNestedSelects(SelectInst 
&OuterSelVal,
 /// and V is `icmp ne X, 5`, impliesPoisonOrCond returns true.
 static bool impliesPoisonOrCond(
     const Value *ValAssumedPoison, const Value *V, bool Expected,
-    llvm::function_ref<bool(unsigned, unsigned)> isValidAddrSpaceCast) {
+    function_ref<bool(unsigned, unsigned)> isValidAddrSpaceCast) {
   // Handle the case that ValAssumedPoison is `icmp eq ptr addrspace(3) X, 
null`
   // and X is `addrspacecast ptr addrspace(1) Y to ptr addrspace(3)`. Target 
can
   // replace X with poison if the addrspacecast is invalid. However, `V` might
diff --git a/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll 
b/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll
index 4791d2c434884..2c2dbc796a31d 100644
--- a/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll
+++ b/llvm/test/Transforms/InstCombine/AMDGPU/addrspacecast.ll
@@ -10,14 +10,15 @@ define i1 @not_fold_select(ptr addrspace(1) noundef %x) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = tail call i1 @llvm.amdgcn.is.shared(ptr 
[[TMP0]])
 ; CHECK-NEXT:    [[TMP2:%.*]] = addrspacecast ptr addrspace(1) [[X]] to ptr 
addrspace(3)
 ; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq ptr addrspace(3) [[TMP2]], null
-; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP1]], i1 true, i1 [[TMP3]]
+; CHECK-NEXT:    [[NOT_IS_SHARED:%.*]] = xor i1 [[TMP1]], true
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[NOT_IS_SHARED]], i1 true, i1 
[[TMP3]]
 ; CHECK-NEXT:    ret i1 [[TMP4]]
 ;
   entry:
-  %0 = addrspacecast ptr addrspace(1) %x to ptr
-  %1 = tail call i1 @llvm.amdgcn.is.shared(ptr %0)
-  %2 = addrspacecast ptr %0 to ptr addrspace(3)
-  %3 = select i1 %1, ptr addrspace(3) null, ptr addrspace(3) %2
-  %4 = icmp eq ptr addrspace(3) %3, null
-  ret i1 %4
+  %asc.flat = addrspacecast ptr addrspace(1) %x to ptr
+  %is.shared = tail call i1 @llvm.amdgcn.is.shared(ptr %asc.flat)
+  %asc.shared = addrspacecast ptr %asc.flat to ptr addrspace(3)
+  %shared.addr = select i1 %is.shared, ptr addrspace(3) %asc.shared, ptr 
addrspace(3) null
+  %result = icmp eq ptr addrspace(3) %shared.addr, null
+  ret i1 %result
 }

>From 3128b338492a977b35b7c39bc770e85a703ca8d0 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Fri, 20 Jun 2025 05:56:59 +0200
Subject: [PATCH 3/4] return true for AddrSpaceCast in canCreateUndefOrPoison,
 update AttributorAttributes to restore previous behavior in
 aapointer_info_map_invalidation.ll

---
 llvm/docs/LangRef.rst                         |  6 ++--
 llvm/include/llvm/Transforms/IPO/Attributor.h |  6 ++++
 llvm/lib/Analysis/ValueTracking.cpp           |  2 ++
 .../Transforms/IPO/AttributorAttributes.cpp   | 18 +++++++---
 .../InstCombine/InstCombineSelect.cpp         | 35 ++++---------------
 .../aapointer_info_map_invalidation.ll        |  2 +-
 6 files changed, 31 insertions(+), 38 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 51d28d6215f3a..f9ee3243eea9d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -12621,15 +12621,15 @@ have no side effects, and must not capture the value 
of the pointer.
 If the source is :ref:`poison <poisonvalues>`, the result is
 :ref:`poison <poisonvalues>`.
 
-If the source is not :ref:`poison <poisonvalues>`, and the result pointer is
-non-dereferenceable, the result is :ref:`poison <poisonvalues>`.
-
 If the source is not :ref:`poison <poisonvalues>`, and both source and
 destination are :ref:`integral pointers <nointptrtype>`, and the
 result pointer is dereferenceable, the cast is assumed to be
 reversible (i.e. casting the result back to the original address space
 should yield the original bit pattern).
 
+Which address space casts are supported depends on the target. Unsupported
+address space casts return :ref:`poison <poisonvalues>`.
+
 Example:
 """"""""
 
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h 
b/llvm/include/llvm/Transforms/IPO/Attributor.h
index f19f3292c4798..2315de25d7b29 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -115,6 +115,7 @@
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
 #include "llvm/Analysis/PostDominators.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/AbstractCallSite.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/ConstantRange.h"
@@ -1294,6 +1295,11 @@ struct InformationCache {
     return AG.getAnalysis<TargetLibraryAnalysis>(F);
   }
 
+  /// Return TargetLibraryInfo for function \p F.
+  TargetTransformInfo *getTargetTransformInfoForFunction(const Function &F) {
+    return AG.getAnalysis<TargetIRAnalysis>(F);
+  }
+
   /// Return true if \p F has the "kernel" function attribute
   bool isKernel(const Function &F) {
     FunctionInfo &FI = getFunctionInfo(F);
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index a17417cb5189c..13c9be794a9ab 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7483,6 +7483,8 @@ static bool canCreateUndefOrPoison(const Operator *Op, 
UndefPoisonKind Kind,
   case Instruction::FCmp:
   case Instruction::GetElementPtr:
     return false;
+  case Instruction::AddrSpaceCast:
+    return true;
   default: {
     const auto *CE = dyn_cast<ConstantExpr>(Op);
     if (isa<CastInst>(Op) || (CE && CE->isCast()))
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp 
b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 5cb8f888354bd..27c5c2e6d5caf 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -7350,8 +7350,7 @@ struct AAPrivatizablePtrArgument final : public 
AAPrivatizablePtrImpl {
     // Verify callee and caller agree on how the promoted argument would be
     // passed.
     Function &Fn = *getIRPosition().getAnchorScope();
-    const auto *TTI =
-        A.getInfoCache().getAnalysisResultForFunction<TargetIRAnalysis>(Fn);
+    const auto *TTI = A.getInfoCache().getTargetTransformInfoForFunction(Fn);
     if (!TTI) {
       LLVM_DEBUG(dbgs() << "[AAPrivatizablePtr] Missing TTI for function "
                         << Fn.getName() << "\n");
@@ -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))) {
     LLVMContext &Ctx = Val.getContext();
     A.manifestAttrs(IRP, Attribute::get(Ctx, Attribute::NoUndef));
     return true;
@@ -12952,8 +12961,7 @@ struct AAAddressSpaceImpl : public AAAddressSpace {
 
       // Use getAssumedAddrSpace if the associated function exists.
       if (F) {
-        auto *TTI =
-            
A.getInfoCache().getAnalysisResultForFunction<TargetIRAnalysis>(*F);
+        auto *TTI = A.getInfoCache().getTargetTransformInfoForFunction(*F);
         unsigned AssumedAS = TTI->getAssumedAddrSpace(&Obj);
         if (AssumedAS != ~0U)
           return takeAddressSpace(AssumedAS);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index c470362ba75d4..73ba0f78e8053 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -3194,23 +3194,8 @@ static Instruction *foldNestedSelects(SelectInst 
&OuterSelVal,
 /// Return true if V is poison or \p Expected given that ValAssumedPoison is
 /// already poison. For example, if ValAssumedPoison is `icmp samesign X, 10`
 /// and V is `icmp ne X, 5`, impliesPoisonOrCond returns true.
-static bool impliesPoisonOrCond(
-    const Value *ValAssumedPoison, const Value *V, bool Expected,
-    function_ref<bool(unsigned, unsigned)> isValidAddrSpaceCast) {
-  // Handle the case that ValAssumedPoison is `icmp eq ptr addrspace(3) X, 
null`
-  // and X is `addrspacecast ptr addrspace(1) Y to ptr addrspace(3)`. Target 
can
-  // replace X with poison if the addrspacecast is invalid. However, `V` might
-  // not be poison.
-  if (auto *ICmp = dyn_cast<ICmpInst>(ValAssumedPoison)) {
-    auto CanCreatePoison = [&](Value *Op) {
-      auto *ASC = dyn_cast<AddrSpaceCastInst>(Op);
-      return ASC && !isValidAddrSpaceCast(ASC->getDestAddressSpace(),
-                                          ASC->getSrcAddressSpace());
-    };
-    if (llvm::any_of(ICmp->operands(), CanCreatePoison))
-      return false;
-  }
-
+static bool impliesPoisonOrCond(const Value *ValAssumedPoison, const Value *V,
+                                bool Expected) {
   if (impliesPoison(ValAssumedPoison, V))
     return true;
 
@@ -3256,23 +3241,17 @@ Instruction 
*InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
   auto *Zero = ConstantInt::getFalse(SelType);
   Value *A, *B, *C, *D;
 
-  auto IsValidAddrSpaceCast = [&](unsigned FromAS, unsigned ToAS) {
-    return isValidAddrSpaceCast(FromAS, ToAS);
-  };
-
   // Folding select to and/or i1 isn't poison safe in general. impliesPoison
   // checks whether folding it does not convert a well-defined value into
   // poison.
   if (match(TrueVal, m_One())) {
-    if (impliesPoisonOrCond(FalseVal, CondVal, /*Expected=*/false,
-                            IsValidAddrSpaceCast)) {
+    if (impliesPoisonOrCond(FalseVal, CondVal, /*Expected=*/false)) {
       // Change: A = select B, true, C --> A = or B, C
       return BinaryOperator::CreateOr(CondVal, FalseVal);
     }
 
     if (match(CondVal, m_OneUse(m_Select(m_Value(A), m_One(), m_Value(B)))) &&
-        impliesPoisonOrCond(FalseVal, B, /*Expected=*/false,
-                            IsValidAddrSpaceCast)) {
+        impliesPoisonOrCond(FalseVal, B, /*Expected=*/false)) {
       // (A || B) || C --> A || (B | C)
       return replaceInstUsesWith(
           SI, Builder.CreateLogicalOr(A, Builder.CreateOr(B, FalseVal)));
@@ -3308,15 +3287,13 @@ Instruction 
*InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
   }
 
   if (match(FalseVal, m_Zero())) {
-    if (impliesPoisonOrCond(TrueVal, CondVal, /*Expected=*/true,
-                            IsValidAddrSpaceCast)) {
+    if (impliesPoisonOrCond(TrueVal, CondVal, /*Expected=*/true)) {
       // Change: A = select B, C, false --> A = and B, C
       return BinaryOperator::CreateAnd(CondVal, TrueVal);
     }
 
     if (match(CondVal, m_OneUse(m_Select(m_Value(A), m_Value(B), m_Zero()))) &&
-        impliesPoisonOrCond(TrueVal, B, /*Expected=*/true,
-                            IsValidAddrSpaceCast)) {
+        impliesPoisonOrCond(TrueVal, B, /*Expected=*/true)) {
       // (A && B) && C --> A && (B & C)
       return replaceInstUsesWith(
           SI, Builder.CreateLogicalAnd(A, Builder.CreateAnd(B, TrueVal)));
diff --git 
a/llvm/test/Transforms/Attributor/reduced/aapointer_info_map_invalidation.ll 
b/llvm/test/Transforms/Attributor/reduced/aapointer_info_map_invalidation.ll
index 9a5f789e88fa9..30270b20d9292 100644
--- a/llvm/test/Transforms/Attributor/reduced/aapointer_info_map_invalidation.ll
+++ b/llvm/test/Transforms/Attributor/reduced/aapointer_info_map_invalidation.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --function-signature --scrub-attributes --check-attributes
-; RUN: opt -passes=attributor -S < %s | FileCheck %s --check-prefixes=CHECK
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -passes=attributor -S < %s | FileCheck 
%s --check-prefixes=CHECK
 
 define amdgpu_kernel void 
@__omp_offloading_fd00_2c00523__ZN11qmcplusplus7ompBLAS9gemv_implIfEEiRiciiT_PKS3_iS5_iS3_PS3_i_l383()
 {
 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind 
willreturn

>From b86394e543ba70826d49436cb6aa0759459807b5 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Fri, 20 Jun 2025 09:40:52 +0200
Subject: [PATCH 4/4] update clang tests

---
 clang/test/CodeGenOpenCL/amdgcn-buffer-rsrc-type.cl | 2 +-
 clang/test/CodeGenOpenCL/as_type.cl                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/CodeGenOpenCL/amdgcn-buffer-rsrc-type.cl 
b/clang/test/CodeGenOpenCL/amdgcn-buffer-rsrc-type.cl
index 62fd20c4d1414..f9d7968fc5570 100644
--- a/clang/test/CodeGenOpenCL/amdgcn-buffer-rsrc-type.cl
+++ b/clang/test/CodeGenOpenCL/amdgcn-buffer-rsrc-type.cl
@@ -44,7 +44,7 @@ void consumeBufferPtr(__amdgpu_buffer_rsrc_t *p) {
 // CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[A]], align 16, 
!tbaa [[TBAA8:![0-9]+]]
 // CHECK-NEXT:    [[TOBOOL_NOT:%.*]] = icmp eq i32 [[TMP0]], 0
 // CHECK-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq ptr addrspace(5) [[A]], 
addrspacecast (ptr null to ptr addrspace(5))
-// CHECK-NEXT:    [[OR_COND:%.*]] = or i1 [[TOBOOL_NOT_I]], [[TOBOOL_NOT]]
+// CHECK-NEXT:    [[OR_COND:%.*]] = select i1 [[TOBOOL_NOT]], i1 true, i1 
[[TOBOOL_NOT_I]]
 // CHECK-NEXT:    br i1 [[OR_COND]], label [[IF_END:%.*]], label 
[[IF_THEN_I:%.*]]
 // CHECK:       if.then.i:
 // CHECK-NEXT:    [[R:%.*]] = getelementptr inbounds nuw i8, ptr addrspace(5) 
[[A]], i32 16
diff --git a/clang/test/CodeGenOpenCL/as_type.cl 
b/clang/test/CodeGenOpenCL/as_type.cl
index 2c6cdc3810b4d..33e34b03a5633 100644
--- a/clang/test/CodeGenOpenCL/as_type.cl
+++ b/clang/test/CodeGenOpenCL/as_type.cl
@@ -67,7 +67,7 @@ int3 f8(char16 x) {
   return __builtin_astype(x, int3);
 }
 
-//CHECK: define{{.*}} spir_func noundef ptr addrspace(1) @addr_cast(ptr 
noundef readnone captures(ret: address, provenance) %[[x:.*]])
+//CHECK: define{{.*}} spir_func ptr addrspace(1) @addr_cast(ptr noundef 
readnone captures(ret: address, provenance) %[[x:.*]])
 //CHECK: %[[cast:.*]] ={{.*}} addrspacecast ptr %[[x]] to ptr addrspace(1)
 //CHECK: ret ptr addrspace(1) %[[cast]]
 global int* addr_cast(int *x) {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to