================
@@ -359,18 +359,21 @@ class OpLowerer {
     return lowerToBindAndAnnotateHandle(F);
   }
 
-  Error replaceSplitDoubleCallUsages(CallInst *Intrin, CallInst *Op) {
+  Error replaceExtractElementTypeOfCallUsages(CallInst *Intrin, CallInst *Op) {
     for (Use &U : make_early_inc_range(Intrin->uses())) {
       if (auto *EVI = dyn_cast<ExtractValueInst>(U.getUser())) {
 
         if (EVI->getNumIndices() != 1)
-          return createStringError(std::errc::invalid_argument,
-                                   "Splitdouble has only 2 elements");
+          return createStringError(
----------------
Icohedron wrote:

I don't think it is possible to make an HLSL test that exercises the error on 
`if (EVI->getNumIndices() != 1)`. It's just invalid LLVM IR to have more 
indices than allowed for the struct type. It is caught by some other error 
handler:
```
$ opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library 
/home/icohedron/workspace/feature-uaddc/llvm/test/CodeGen/DirectX/UAddc.ll
/home/icohedron/workspace/feature-uaddc/build/bin/opt: 
/home/icohedron/workspace/feature-uaddc/llvm/test/CodeGen/DirectX/UAddc.ll:35:25:
 error: invalid indices for extractvalue
  %carry = extractvalue { i32, i1 } %uaddc, 1, 0
```

The other error is able to be exercised just by having a use that is not an 
extractvalue. For example, returning the `{ i32, i1 }`:
```
$ opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library 
/home/icohedron/workspace/feature-uaddc/llvm/test/CodeGen/DirectX/UAddc.ll
error: <unknown>:0:0: in function test_UAddc2 { i32, i1 } (i32, i32): call use 
is not ExtractValueInst
```

I also see now that `std::string(Intrin->getOpcodeName()` only says "call" and 
doesn't mention the name of the actual intrinsic being called. So that needs to 
be fixed, and an error test should be made.

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

Reply via email to