AMDGPU: Remove intrinsic operand assert
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 14 Mar 2019 23:45:09 +0000 (23:45 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 14 Mar 2019 23:45:09 +0000 (23:45 +0000)
Before r355981, this was under LLVM_DEBUG. I don't think the assert is
quite right, but this really should be a verifier check. Instcombine
should not be asserting on this sort of thing.

llvm-svn: 356219

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll

index 8e97da68819339c32f299f275c1743c55088faf6..bbfcc8bdba0c69a1170d1923a379124f94efd836 100644 (file)
@@ -1635,12 +1635,8 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,
     case Intrinsic::amdgcn_struct_buffer_load_format:
       return simplifyAMDGCNMemoryIntrinsicDemanded(II, DemandedElts);
     default: {
-      if (getAMDGPUImageDMaskIntrinsic(II->getIntrinsicID())) {
-        assert(cast<ConstantInt>(
-                 II->getArgOperand(
-                   II->getNumOperands() - 2))->getZExtValue() == 0);
+      if (getAMDGPUImageDMaskIntrinsic(II->getIntrinsicID()))
         return simplifyAMDGCNMemoryIntrinsicDemanded(II, DemandedElts, 0);
-      }
 
       break;
     }
index e0b8fab411c057f97ed75cefcef718f5289cc0cf..6c03ed2c8fd1b16db9569b07630ae38cb0205f7d 100644 (file)
@@ -2402,6 +2402,17 @@ define amdgpu_ps float @extract_elt0_tfe_image_load_1d_v4f32i32_i32(i32 %s, <8 x
 
 declare {<4 x float>, i32} @llvm.amdgcn.image.load.1d.sl_v4f32i32s.i32(i32, i32, <8 x i32>, i32, i32) #1
 
+; CHECK: @tfe_check_assert(
+; CHECK: %data = call float @llvm.amdgcn.image.load.2d.f32.i32(i32 1, i32 undef, i32 undef, <8 x i32> undef, i32 0, i32 1)
+; CHECK-NEXT: ret float %data
+define amdgpu_hs float @tfe_check_assert() #0 {
+  %data = call nsz <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 15, i32 undef, i32 undef, <8 x i32> undef, i32 0, i32 1) #2
+  %elt0 = extractelement <4 x float> %data, i32 0
+  ret float %elt0
+}
+
+declare <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 immarg, i32, i32, <8 x i32>, i32 immarg, i32 immarg) #1
+
 attributes #0 = { nounwind }
 attributes #1 = { nounwind readonly }