2016-03-16 02:06:20 +08:00
|
|
|
; RUN: opt -S -vectorize-num-stores-pred=1 -force-vector-width=1 -force-vector-interleave=2 -loop-vectorize -verify-loop-info -simplifycfg < %s | FileCheck %s --check-prefix=UNROLL
|
|
|
|
; RUN: opt -S -vectorize-num-stores-pred=1 -force-vector-width=1 -force-vector-interleave=2 -loop-vectorize -verify-loop-info < %s | FileCheck %s --check-prefix=UNROLL-NOSIMPLIFY
|
2016-12-17 03:12:02 +08:00
|
|
|
; RUN: opt -S -vectorize-num-stores-pred=1 -force-vector-width=2 -force-vector-interleave=1 -loop-vectorize -verify-loop-info -simplifycfg < %s | FileCheck %s --check-prefix=VEC
|
2015-09-09 20:51:06 +08:00
|
|
|
|
2014-01-28 09:01:53 +08:00
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
; Test predication of stores.
|
|
|
|
define i32 @test(i32* nocapture %f) #0 {
|
|
|
|
entry:
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
; VEC-LABEL: test
|
[LV] Unify vector and scalar maps
This patch unifies the data structures we use for mapping instructions from the
original loop to their corresponding instructions in the new loop. Previously,
we maintained two distinct maps for this purpose: WidenMap and ScalarIVMap.
WidenMap maintained the vector values each instruction from the old loop was
represented with, and ScalarIVMap maintained the scalar values each scalarized
induction variable was represented with. With this patch, all values created
for the new loop are maintained in VectorLoopValueMap.
The change allows for several simplifications. Previously, when an instruction
was scalarized, we had to insert the scalar values into vectors in order to
maintain the mapping in WidenMap. Then, if a user of the scalarized value was
also scalar, we had to extract the scalar values from the temporary vector we
created. We now aovid these unnecessary scalar-to-vector-to-scalar conversions.
If a scalarized value is used by a scalar instruction, the scalar value is used
directly. However, if the scalarized value is needed by a vector instruction,
we generate the needed insertelement instructions on-demand.
A common idiom in several locations in the code (including the scalarization
code), is to first get the vector values an instruction from the original loop
maps to, and then extract a particular scalar value. This patch adds
getScalarValue for this purpose along side getVectorValue as an interface into
VectorLoopValueMap. These functions work together to return the requested
values if they're available or to produce them if they're not.
The mapping has also be made less permissive. Entries can be added to
VectorLoopValue map with the new initVector and initScalar functions.
getVectorValue has been modified to return a constant reference to the mapped
entries.
There's no real functional change with this patch; however, in some cases we
will generate slightly different code. For example, instead of an insertelement
sequence following the definition of an instruction, it will now precede the
first use of that instruction. This can be seen in the test case changes.
Differential Revision: https://reviews.llvm.org/D23169
llvm-svn: 279649
2016-08-25 02:23:17 +08:00
|
|
|
; VEC: %[[v0:.+]] = add i64 %index, 0
|
2017-03-24 00:07:21 +08:00
|
|
|
; VEC: %[[v2:.+]] = getelementptr inbounds i32, i32* %f, i64 %[[v0]]
|
2014-01-28 09:01:53 +08:00
|
|
|
; VEC: %[[v8:.+]] = icmp sgt <2 x i32> %{{.*}}, <i32 100, i32 100>
|
2017-07-31 21:21:42 +08:00
|
|
|
; VEC: %[[v11:.+]] = extractelement <2 x i1> %[[v8]], i32 0
|
|
|
|
; VEC: br i1 %[[v11]], label %[[cond:.+]], label %[[else:.+]]
|
2014-01-28 09:01:53 +08:00
|
|
|
;
|
|
|
|
; VEC: [[cond]]:
|
2016-12-07 23:03:32 +08:00
|
|
|
; VEC: %[[v13:.+]] = extractelement <2 x i32> %wide.load, i32 0
|
|
|
|
; VEC: %[[v9a:.+]] = add nsw i32 %[[v13]], 20
|
|
|
|
; VEC: store i32 %[[v9a]], i32* %[[v2]], align 4
|
2014-01-28 09:01:53 +08:00
|
|
|
; VEC: br label %[[else:.+]]
|
|
|
|
;
|
|
|
|
; VEC: [[else]]:
|
2017-07-31 21:21:42 +08:00
|
|
|
; VEC: %[[v15:.+]] = extractelement <2 x i1> %[[v8]], i32 1
|
|
|
|
; VEC: br i1 %[[v15]], label %[[cond2:.+]], label %[[else2:.+]]
|
2014-01-28 09:01:53 +08:00
|
|
|
;
|
|
|
|
; VEC: [[cond2]]:
|
2016-12-07 23:03:32 +08:00
|
|
|
; VEC: %[[v17:.+]] = extractelement <2 x i32> %wide.load, i32 1
|
|
|
|
; VEC: %[[v9b:.+]] = add nsw i32 %[[v17]], 20
|
2016-10-26 02:59:45 +08:00
|
|
|
; VEC: %[[v1:.+]] = add i64 %index, 1
|
|
|
|
; VEC: %[[v4:.+]] = getelementptr inbounds i32, i32* %f, i64 %[[v1]]
|
2016-12-07 23:03:32 +08:00
|
|
|
; VEC: store i32 %[[v9b]], i32* %[[v4]], align 4
|
2014-01-28 09:01:53 +08:00
|
|
|
; VEC: br label %[[else2:.+]]
|
|
|
|
;
|
|
|
|
; VEC: [[else2]]:
|
|
|
|
|
|
|
|
; UNROLL-LABEL: test
|
|
|
|
; UNROLL: vector.body:
|
|
|
|
; UNROLL: %[[IND:[a-zA-Z0-9]+]] = add i64 %{{.*}}, 0
|
|
|
|
; UNROLL: %[[IND1:[a-zA-Z0-9]+]] = add i64 %{{.*}}, 1
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
; UNROLL: %[[v0:[a-zA-Z0-9]+]] = getelementptr inbounds i32, i32* %f, i64 %[[IND]]
|
|
|
|
; UNROLL: %[[v1:[a-zA-Z0-9]+]] = getelementptr inbounds i32, i32* %f, i64 %[[IND1]]
|
2015-02-28 05:17:42 +08:00
|
|
|
; UNROLL: %[[v2:[a-zA-Z0-9]+]] = load i32, i32* %[[v0]], align 4
|
|
|
|
; UNROLL: %[[v3:[a-zA-Z0-9]+]] = load i32, i32* %[[v1]], align 4
|
2014-01-28 09:01:53 +08:00
|
|
|
; UNROLL: %[[v4:[a-zA-Z0-9]+]] = icmp sgt i32 %[[v2]], 100
|
|
|
|
; UNROLL: %[[v5:[a-zA-Z0-9]+]] = icmp sgt i32 %[[v3]], 100
|
2017-07-31 21:21:42 +08:00
|
|
|
; UNROLL: br i1 %[[v4]], label %[[cond:[a-zA-Z0-9.]+]], label %[[else:[a-zA-Z0-9.]+]]
|
2014-01-28 09:01:53 +08:00
|
|
|
;
|
|
|
|
; UNROLL: [[cond]]:
|
2016-10-26 02:59:45 +08:00
|
|
|
; UNROLL: %[[v6:[a-zA-Z0-9]+]] = add nsw i32 %[[v2]], 20
|
2014-01-28 09:01:53 +08:00
|
|
|
; UNROLL: store i32 %[[v6]], i32* %[[v0]], align 4
|
|
|
|
; UNROLL: br label %[[else]]
|
|
|
|
;
|
|
|
|
; UNROLL: [[else]]:
|
2017-07-31 21:21:42 +08:00
|
|
|
; UNROLL: br i1 %[[v5]], label %[[cond2:[a-zA-Z0-9.]+]], label %[[else2:[a-zA-Z0-9.]+]]
|
2014-01-28 09:01:53 +08:00
|
|
|
;
|
|
|
|
; UNROLL: [[cond2]]:
|
2016-10-26 02:59:45 +08:00
|
|
|
; UNROLL: %[[v7:[a-zA-Z0-9]+]] = add nsw i32 %[[v3]], 20
|
2014-01-28 09:01:53 +08:00
|
|
|
; UNROLL: store i32 %[[v7]], i32* %[[v1]], align 4
|
|
|
|
; UNROLL: br label %[[else2]]
|
|
|
|
;
|
|
|
|
; UNROLL: [[else2]]:
|
|
|
|
|
|
|
|
for.body:
|
|
|
|
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%arrayidx = getelementptr inbounds i32, i32* %f, i64 %indvars.iv
|
2015-02-28 05:17:42 +08:00
|
|
|
%0 = load i32, i32* %arrayidx, align 4
|
2014-01-28 09:01:53 +08:00
|
|
|
%cmp1 = icmp sgt i32 %0, 100
|
|
|
|
br i1 %cmp1, label %if.then, label %for.inc
|
|
|
|
|
|
|
|
if.then:
|
|
|
|
%add = add nsw i32 %0, 20
|
|
|
|
store i32 %add, i32* %arrayidx, align 4
|
|
|
|
br label %for.inc
|
|
|
|
|
|
|
|
for.inc:
|
|
|
|
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
|
|
|
|
%exitcond = icmp eq i64 %indvars.iv.next, 128
|
|
|
|
br i1 %exitcond, label %for.end, label %for.body
|
|
|
|
|
|
|
|
for.end:
|
|
|
|
ret i32 0
|
|
|
|
}
|
2014-02-09 04:41:13 +08:00
|
|
|
|
|
|
|
; Track basic blocks when unrolling conditional blocks. This code used to assert
|
|
|
|
; because we did not update the phi nodes with the proper predecessor in the
|
|
|
|
; vectorized loop body.
|
|
|
|
; PR18724
|
|
|
|
|
2015-09-09 20:51:06 +08:00
|
|
|
; UNROLL-NOSIMPLIFY-LABEL: bug18724
|
|
|
|
; UNROLL-NOSIMPLIFY: store i32
|
|
|
|
; UNROLL-NOSIMPLIFY: store i32
|
2014-02-09 04:41:13 +08:00
|
|
|
|
|
|
|
define void @bug18724() {
|
|
|
|
entry:
|
|
|
|
br label %for.body9
|
|
|
|
|
|
|
|
for.body9:
|
|
|
|
br i1 undef, label %for.inc26, label %for.body14
|
|
|
|
|
|
|
|
for.body14:
|
|
|
|
%indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc23 ], [ undef, %for.body9 ]
|
|
|
|
%iNewChunks.120 = phi i32 [ %iNewChunks.2, %for.inc23 ], [ undef, %for.body9 ]
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%arrayidx16 = getelementptr inbounds [768 x i32], [768 x i32]* undef, i64 0, i64 %indvars.iv3
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* %arrayidx16, align 4
|
2014-02-09 04:41:13 +08:00
|
|
|
br i1 undef, label %if.then18, label %for.inc23
|
|
|
|
|
|
|
|
if.then18:
|
|
|
|
store i32 2, i32* %arrayidx16, align 4
|
|
|
|
%inc21 = add nsw i32 %iNewChunks.120, 1
|
|
|
|
br label %for.inc23
|
|
|
|
|
|
|
|
for.inc23:
|
|
|
|
%iNewChunks.2 = phi i32 [ %inc21, %if.then18 ], [ %iNewChunks.120, %for.body14 ]
|
|
|
|
%indvars.iv.next4 = add nsw i64 %indvars.iv3, 1
|
|
|
|
%tmp1 = trunc i64 %indvars.iv3 to i32
|
|
|
|
%cmp13 = icmp slt i32 %tmp1, 0
|
|
|
|
br i1 %cmp13, label %for.body14, label %for.inc26
|
|
|
|
|
|
|
|
for.inc26:
|
|
|
|
%iNewChunks.1.lcssa = phi i32 [ undef, %for.body9 ], [ %iNewChunks.2, %for.inc23 ]
|
|
|
|
unreachable
|
|
|
|
}
|
2016-12-17 00:52:35 +08:00
|
|
|
|
|
|
|
; VEC-LABEL: @minimal_bit_widths(
|
|
|
|
;
|
|
|
|
; In the test below, it's more profitable for the expression feeding the
|
|
|
|
; conditional store to remain scalar. Since we can only type-shrink vector
|
|
|
|
; types, we shouldn't try to represent the expression in a smaller type.
|
|
|
|
;
|
|
|
|
; VEC: vector.body:
|
|
|
|
; VEC: %wide.load = load <2 x i8>, <2 x i8>* {{.*}}, align 1
|
|
|
|
; VEC: br i1 {{.*}}, label %[[IF0:.+]], label %[[CONT0:.+]]
|
|
|
|
; VEC: [[IF0]]:
|
|
|
|
; VEC: %[[E0:.+]] = extractelement <2 x i8> %wide.load, i32 0
|
|
|
|
; VEC: %[[Z0:.+]] = zext i8 %[[E0]] to i32
|
|
|
|
; VEC: %[[T0:.+]] = trunc i32 %[[Z0]] to i8
|
|
|
|
; VEC: store i8 %[[T0]], i8* {{.*}}, align 1
|
|
|
|
; VEC: br label %[[CONT0]]
|
|
|
|
; VEC: [[CONT0]]:
|
|
|
|
; VEC: br i1 {{.*}}, label %[[IF1:.+]], label %[[CONT1:.+]]
|
|
|
|
; VEC: [[IF1]]:
|
|
|
|
; VEC: %[[E1:.+]] = extractelement <2 x i8> %wide.load, i32 1
|
|
|
|
; VEC: %[[Z1:.+]] = zext i8 %[[E1]] to i32
|
|
|
|
; VEC: %[[T1:.+]] = trunc i32 %[[Z1]] to i8
|
|
|
|
; VEC: store i8 %[[T1]], i8* {{.*}}, align 1
|
|
|
|
; VEC: br label %[[CONT1]]
|
|
|
|
; VEC: [[CONT1]]:
|
|
|
|
; VEC: br i1 {{.*}}, label %middle.block, label %vector.body
|
|
|
|
;
|
|
|
|
define void @minimal_bit_widths(i1 %c) {
|
|
|
|
entry:
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
for.body:
|
|
|
|
%tmp0 = phi i64 [ %tmp6, %for.inc ], [ 0, %entry ]
|
|
|
|
%tmp1 = phi i64 [ %tmp7, %for.inc ], [ undef, %entry ]
|
|
|
|
%tmp2 = getelementptr i8, i8* undef, i64 %tmp0
|
|
|
|
%tmp3 = load i8, i8* %tmp2, align 1
|
|
|
|
br i1 %c, label %if.then, label %for.inc
|
|
|
|
|
|
|
|
if.then:
|
|
|
|
%tmp4 = zext i8 %tmp3 to i32
|
|
|
|
%tmp5 = trunc i32 %tmp4 to i8
|
|
|
|
store i8 %tmp5, i8* %tmp2, align 1
|
|
|
|
br label %for.inc
|
|
|
|
|
|
|
|
for.inc:
|
|
|
|
%tmp6 = add nuw nsw i64 %tmp0, 1
|
|
|
|
%tmp7 = add i64 %tmp1, -1
|
|
|
|
%tmp8 = icmp eq i64 %tmp7, 0
|
|
|
|
br i1 %tmp8, label %for.end, label %for.body
|
|
|
|
|
|
|
|
for.end:
|
|
|
|
ret void
|
|
|
|
}
|