Commit 855a0c1
Fix #8598: don't emit *.with.overflow intrinsics for DXIL
InstCombine folds the "widened multiply/add compared against a max value"
overflow-check idioms into llvm.umul.with.overflow / llvm.sadd.with.overflow.
These intrinsics (and the extractvalue of their result struct) are not legal
in DXIL, so shaders using them failed validation once optimizations were on.
Guard ProcessUMulZExtIdiom and ProcessUGT_ADDCST_ADD to bail out for the DXIL
target, mirroring the existing isDXIL() guard on bswap matching. The plain
multiply/add and compare are kept, which is what DXIL wants anyway.
Adds .ll regression tests for both idioms plus an end-to-end HLSL test built
from the issue repro.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 5853990 commit 855a0c1
4 files changed
Lines changed: 79 additions & 0 deletions
File tree
- lib/Transforms/InstCombine
- tools/clang/test
- DXC/Passes/InstructionCombining
- HLSLFileCheck/hlsl/intrinsics/mul
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
2053 | 2054 | | |
2054 | 2055 | | |
2055 | 2056 | | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
2056 | 2061 | | |
2057 | 2062 | | |
2058 | 2063 | | |
| |||
2245 | 2250 | | |
2246 | 2251 | | |
2247 | 2252 | | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
2248 | 2257 | | |
2249 | 2258 | | |
2250 | 2259 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments