Commit Graph

3236 Commits

Author SHA1 Message Date
Alastair Donaldson
6cdae9da72
spirv-fuzz: Do not allow sampled image load when flattening conditionals (#3930)
Fixes #3928.
2020-10-19 17:32:26 +01:00
Alastair Donaldson
7e1825a596
spirv-fuzz: Take care of OpPhi instructions when inlining (#3939)
Fixes #3938.
2020-10-19 09:41:01 +01:00
Alastair Donaldson
502e982956
spirv-fuzz: Fix to TransformationInlineFunction (#3913)
This fixes a problem where TransformationInlineFunction could lead to
distinct instructions having identical unique ids. It adds a validity
check to detect this problem in general.

Fixes #3911.
2020-10-16 22:58:09 +01:00
Alastair Donaldson
bf1a11dab7
spirv-fuzz: Wrap early terminators before merging returns (#3925)
Incorporates some other fixes for issues that were brought to light by
adding this functionality.

Fixes #3717.
Fixes #3924.
2020-10-16 19:29:39 +01:00
Jaebaek Seo
fd3948e161
Add DebugValue for function param regardless of scope (#3923)
`DebugInfoManager::AddDebugValueIfVarDeclIsVisible()` adds
OpenCL.DebugInfo.100 DebugValue from DebugDeclare only when the
DebugDeclare is visible to the give scope. It helps us correctly
handle a reference variable e.g.,

{ // scope #1.
  int foo = /* init */;
  { // scope #2.
    int& bar = foo;
    ...

in the above code, we must not propagate DebugValue of `int& bar` for
store instructions in the scope #1 because it is alive only in
the scope #2.

We have an exception: If the given DebugDeclare is used for a function
parameter, `DebugInfoManager::AddDebugValueIfVarDeclIsVisible()` has
to always add DebugValue instruction regardless
of the scope. It is because the initializer (store instruction) for
the function parameter can be out of the function parameter's scope
(the function) in particular when the function was inlined.

Without this change, the function parameter value information always
disappears whenever we run the function inlining pass and
`DebugInfoManager::AddDebugValueIfVarDeclIsVisible()`.
2020-10-16 10:18:41 -04:00
Alastair Donaldson
663d050a98
Temporary fix to make GoogleTest compile. (#3922) 2020-10-16 14:58:35 +01:00
Alastair Donaldson
dd534e877e
spirv-fuzz: Lower probability of adding bit instruction synonyms (#3917)
Fixes #3914.
2020-10-15 15:20:05 +01:00
Alastair Donaldson
53aeba10cd
spirv-fuzz: Fix handling of OpPhi in FlattenConditionalBranch (#3916)
Fixes #3915.
2020-10-15 14:41:23 +01:00
Alastair Donaldson
5c64374dd6
spirv-fuzz: Avoid creating blocks without parents (#3908)
The validity check during fuzzing and in unit tests is strengthened to
require that every block has its enclosing function as its parent.
TransformationMergeFunctionReturns is fixed so that it ensures parents
are set appropriately.

Fixes #3907.
2020-10-13 19:48:18 +01:00
Alastair Donaldson
57b3723c5c
spirv-fuzz: Do not allow creation of constants of block-decorated structs (#3903)
Fixes #3902.
2020-10-13 18:35:41 +01:00
Alastair Donaldson
12ca825a60
spirv-fuzz: Fixes related to irrelevant ids (#3901)
Fixes #3899.
Fixes #3900.
2020-10-13 18:01:42 +01:00
Alastair Donaldson
2e6cf706ee
spirv-fuzz: Fix to transformation that adds a synonym via a loop (#3898)
Fixes #3897.
2020-10-13 14:26:47 +01:00
Alastair Donaldson
4b884928db
spirv-fuzz: Fix to duplicate region with selection (#3896)
Fixes #3895.
2020-10-13 14:25:43 +01:00
Alastair Donaldson
c2553a315f
spirv-fuzz: Do not expose synonym facts for non-existent ids (#3891)
Fixes #3888.
2020-10-09 07:18:46 +01:00
Alastair Donaldson
3602287858
spirv-fuzz: Do not add synonyms involving irrelevant ids (#3890)
Fixes #3886.
2020-10-08 22:34:39 +01:00
Alastair Donaldson
d52f79122a
spirv-fuzz: Do not replace irrelevant ids that are not in blocks (#3892)
Fixes #3889.
2020-10-08 22:33:46 +01:00
Alastair Donaldson
e022659922
spirv-fuzz: Wrap OpKill and similar in function calls (#3884)
Part of #3717.
2020-10-08 22:33:14 +01:00
dan sinclair
11d5924227
Update val to handle reversed instruction sections. (#3887)
Currently the validator, when checking an instruction is in the correct
section, always advances the current section. This means if we have an
instruction from a previous section we'll end up reporting it as invalid
in a function definition. This error is confusing.

This CL updates the validator to check if the given opcode is from a
previous layout section before advancing the current section. If it is
from a previous layout section an error is emitted.
2020-10-08 13:10:12 -04:00
Alastair Donaldson
fc8264854c
spirv-fuzz: Replace dead-block terminators with OpKill etc. (#3882)
Fixes #3615.
2020-10-06 15:59:05 +01:00
Vasyl Teliman
63cc22d645
spirv-fuzz: TransformationPropagateInstructionDown (#3692)
Fixes #3691.
2020-10-06 13:38:19 +01:00
Alastair Donaldson
65b2a9e814
spirv-fuzz: Transformation to add wrappers for OpKill and similar (#3881)
Part of #3717.
2020-10-06 12:07:56 +01:00
Alastair Donaldson
624b16cd0c
spirv-fuzz: Use overflow ids when duplicating regions (#3878)
Fixes #3786.
2020-10-06 12:07:20 +01:00
Vasyl Teliman
bd0dd9cef1
spirv-fuzz: Fix rvalue references (#3883)
Fixes #3659.
2020-10-06 12:06:53 +01:00
Alastair Donaldson
f151337880
spirv-fuzz: Avoid using block-decorated structs in transformations (#3877)
Fixes #3875.
2020-10-02 20:01:08 +01:00
Alastair Donaldson
0e85530728
spirv-fuzz: Use overflow ids when inlining functions (#3880)
Fixes #3751.
2020-10-02 16:53:54 +01:00
Jaebaek Seo
67f8e2eddc
Debug info preservation in convert-local-access-chains pass (#3835)
1. DebugValue/DebugDeclare references of load/store must not change
the behaviors of the convert-local-access-chains pass
2. We have to properly set the scope and line information of new
instructions made by the convert-local-access-chains pass
2020-10-02 10:45:24 -04:00
Vasyl Teliman
d91afd8de2
spirv-fuzz: Refactor fact manager tests (#3879)
Fixes #3698.
2020-10-02 08:51:54 +01:00
Alastair Donaldson
b920b620ad
spirv-fuzz: Integrate spirv-reduce with shrinker (#3849)
This extends shrinking so that spirv-reduce is employed to simplify
the functions that are added by TransformationAddFunction.
2020-10-02 04:53:12 +01:00
Alastair Donaldson
74a711a76d
spirv-fuzz: Only recommend passes when a pass had an effect (#3863)
Fixes #3817.
2020-10-02 04:48:39 +01:00
Stefano Milizia
fc7860e2db
spirv-fuzz: Merge the return instructions in a function (#3838)
This PR introduces TransformationMergeFunctionReturns, which changes
a function so that it only has one reachable return statement.

Fixes #3655.
2020-10-02 04:45:44 +01:00
Jaebaek Seo
57abfd88c5
Debug info preservation in redundancy-elimination pass (#3839)
* Debug info preservation in redundancy-elimination pass
2020-10-01 09:22:16 -04:00
Jaebaek Seo
e246038364
Debug info preservation in if-conversion pass (#3861)
* Debug info preservation in if-conversion pass
2020-10-01 09:20:27 -04:00
Vasyl Teliman
16cc197c8c
spirv-fuzz: Refactor conditions in the fact manager (#3867)
Refactors conditions and names of some methods in the fact manager. Part of #3698.
2020-10-01 11:48:47 +01:00
Vasyl Teliman
615fbe6cbc
spirv-fuzz: TransformationWrapRegionInSelection (#3674)
Fixes #3675.
2020-10-01 09:54:10 +01:00
Alastair Donaldson
f2b8a4ee51
spirv-fuzz: Enable some passes with high probability (#3860)
Fixes #3764.
2020-10-01 09:07:06 +01:00
Alastair Donaldson
50e04f6123
spirv-fuzz: Do not add constants for Block-decorated structs (#3862)
Fixes #3794.
2020-10-01 09:06:36 +01:00
Vasyl Teliman
8edd79ddcc
spirv-fuzz: Fix to FuzzerPassFlattenConditionalBranches (#3865)
Fixes #3864.
2020-10-01 09:06:00 +01:00
Vasyl Teliman
719bade4ff
spirv-fuzz: Fix TransformationRecordSynonymousConstants (#3868)
Fixes #3866.
2020-09-30 17:05:10 +01:00
Alastair Donaldson
009facc978
spirv-fuzz: Fix flatten conditional branch transformation (#3859)
Fixes #3850.
2020-09-30 11:43:40 +01:00
Alastair Donaldson
fcb22ecf0f
spirv-fuzz: Report fresh ids in transformations (#3856)
Adds a virtual method, GetFreshIds(), to Transformation. Every
transformation uses this to indicate which ids in its protobuf message
are fresh ids. This means that when replaying a sequence of
transformations the replayer can obtain a smallest id that is not in
use by the module already and that will not be used by any
transformation by necessity. Ids greater than or equal to this id
can be used as overflow ids.

Fixes #3851.
2020-09-29 22:12:49 +01:00
dan sinclair
c6ca885c0b
[spirv-dis] Add some context comments to disassembly. (#3847)
This CL adds some extra new lines and context comments into the
spirv-dis output format. This CL adds:

 - Blank line and '; Annotations' before decorations
 - Blank line and '; Debug Information' before debug instructions
 - Blank line and '; Types, variables and constants' before type section
 - Blank line and '; Function <name>' before each function.

Issue #788
2020-09-28 10:59:50 -04:00
Maksim Ivanov
446adb05ff
Fix use-after-move in val/validate.cpp (#3848)
Fix a use-after-move (potential) bug found by the
"bugprone-use-after-move" clang-tidy check.

This is part of a Chromium-related effort (see
https://crbug.com/1122844).
2020-09-28 10:49:24 -04:00
Antoni Karpiński
4b07d50cd9
spirv-fuzz: Fix bug in TransformationDuplicateRegionWithSelection (#3819)
The following changes are introduced:

1. Entry block might have more than one predecessor, even if it is not
   a selection/loop merge block. However Apply method asserts that
   there is only one predecessor. Now, IsApplicable method ensures
   that there is only one predecessor.

2. In fuzzer pass we exclude both loop headers and selection headers
as potential exit blocks.

Fixes #3827.
2020-09-26 19:18:41 +01:00
André Perez
fec56146a7
spirv-fuzz: Support OpNot bit instruction case (#3841)
This PR implements the OpNot instruction for the
add bit instruction synonym transformation. In addition,
some code improvements have been made.
2020-09-26 10:42:46 +01:00
Alastair Donaldson
9e17b9d07a
spirv-fuzz: Return IR and transformation context after replay (#3846)
Before this change, the replayer would return a SPIR-V binary. This
did not allow further transforming the resulting module: it would need
to be re-parsed, and the transformation context arising from the
replayed transformations was not available. This change makes it so
that after replay an IR context and transformation context are
returned instead; the IR context can subsequently be turned into a
binary if desired.

This change paves the way for an upcoming PR to integrate spirv-reduce
with the spirv-fuzz shrinker.
2020-09-25 09:58:10 +01:00
Paul Thomson
e12087d6c3
spirv-fuzz: fix test (#3845)
Fix test that broke due to a merge.
2020-09-24 19:38:50 +01:00
Alastair Donaldson
9edeeafdb6
spirv-fuzz: Use unique_ptr<FactManager> in TransformationContext (#3844)
TransformationContext now holds a std::unique_ptr to a FactManager,
rather than a plain pointer. This makes it easier for clients of
TransformationContext to work with heap-allocated instances of
TransformationContext, which is needed in some upcoming work.
2020-09-24 17:28:49 +01:00
Ehsan Nasiri
50dacda553 Start SPIRV-Tools v2020.6 2020-09-24 10:58:53 -04:00
Ehsan Nasiri
b27e039c68 Finalize SPIRV-Tools v2020.5 2020-09-24 10:53:49 -04:00
Ehsan Nasiri
a5903a969b Update CHANGES 2020-09-24 10:52:17 -04:00