File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -105,4 +105,33 @@ EXIT STATUS
105
105
:program: `llvm-reduce ` returns 0 under normal operation. It returns a non-zero
106
106
exit code if there were any errors.
107
107
108
+ EXAMPLE
109
+ -------
108
110
111
+ :program: `llvm-reduce ` can be used to simplify a test that causes a
112
+ compiler crash.
113
+
114
+ For example, let's assume that `opt ` is crashing on the IR file
115
+ `test.ll ` with error message `Assertion failed at line 1234 of
116
+ WhateverFile.cpp `, when running at `-O2 `.
117
+
118
+ The test case of `test.ll ` can be reduced by invoking the following
119
+ command:
120
+
121
+ .. code-block :: bash
122
+
123
+ $( LLVM_BUILD_FOLDER) /bin/llvm-reduce --test=script.sh < path to> /test.ll
124
+
125
+ The shell script passed to the option `test ` consists of the
126
+ following:
127
+
128
+ .. code-block :: bash
129
+
130
+ $( LLVM_BUILD_FOLDER) /bin/opt -O2 -disable-output $1 \
131
+ | & grep " Assertion failed at line 1234 of WhateverFile.cpp"
132
+
133
+ (In this script, `grep ` exits with 0 if it finds the string and that
134
+ becomes the whole script's status.)
135
+
136
+ This example can be generalized to other tools that process IR files,
137
+ for example `llc `.
You can’t perform that action at this time.
0 commit comments