2010-04-12 02:21:50 +00:00
|
|
|
; RUN: opt -indvars -S < %s | FileCheck %s
|
|
|
|
|
|
|
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
|
|
|
|
|
|
|
@X = external global [0 x double]
|
|
|
|
|
|
|
|
; Indvars should be able to simplify simple comparisons involving
|
|
|
|
; induction variables.
|
|
|
|
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @foo(
|
2010-04-12 02:21:50 +00:00
|
|
|
; CHECK: %cond = and i1 %tobool.not, true
|
|
|
|
|
|
|
|
define void @foo(i64 %n, i32* nocapture %p) nounwind {
|
|
|
|
entry:
|
|
|
|
%cmp9 = icmp sgt i64 %n, 0
|
|
|
|
br i1 %cmp9, label %pre, label %return
|
|
|
|
|
|
|
|
pre:
|
2015-02-27 21:17:42 +00:00
|
|
|
%t3 = load i32, i32* %p
|
2010-04-12 02:21:50 +00:00
|
|
|
%tobool.not = icmp ne i32 %t3, 0
|
|
|
|
br label %loop
|
|
|
|
|
|
|
|
loop:
|
|
|
|
%i = phi i64 [ 0, %pre ], [ %inc, %for.inc ]
|
|
|
|
%cmp6 = icmp slt i64 %i, %n
|
|
|
|
%cond = and i1 %tobool.not, %cmp6
|
|
|
|
br i1 %cond, label %if.then, label %for.inc
|
|
|
|
|
|
|
|
if.then:
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%arrayidx = getelementptr [0 x double], [0 x double]* @X, i64 0, i64 %i
|
2010-04-12 02:21:50 +00:00
|
|
|
store double 3.200000e+00, double* %arrayidx
|
|
|
|
br label %for.inc
|
|
|
|
|
|
|
|
for.inc:
|
|
|
|
%inc = add nsw i64 %i, 1
|
|
|
|
%exitcond = icmp sge i64 %inc, %n
|
|
|
|
br i1 %exitcond, label %return, label %loop
|
|
|
|
|
|
|
|
return:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Don't eliminate an icmp that's contributing to the loop exit test though.
|
|
|
|
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @_ZNK4llvm5APInt3ultERKS0_(
|
2010-04-12 02:21:50 +00:00
|
|
|
; CHECK: %tmp99 = icmp sgt i32 %i, -1
|
|
|
|
|
|
|
|
define i32 @_ZNK4llvm5APInt3ultERKS0_(i32 %tmp2.i1, i64** %tmp65, i64** %tmp73, i64** %tmp82, i64** %tmp90) {
|
|
|
|
entry:
|
|
|
|
br label %bb18
|
|
|
|
|
|
|
|
bb13:
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp66 = load i64*, i64** %tmp65, align 4
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp68 = getelementptr inbounds i64, i64* %tmp66, i32 %i
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp69 = load i64, i64* %tmp68, align 4
|
|
|
|
%tmp74 = load i64*, i64** %tmp73, align 4
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp76 = getelementptr inbounds i64, i64* %tmp74, i32 %i
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp77 = load i64, i64* %tmp76, align 4
|
2010-04-12 02:21:50 +00:00
|
|
|
%tmp78 = icmp ugt i64 %tmp69, %tmp77
|
|
|
|
br i1 %tmp78, label %bb20.loopexit, label %bb15
|
|
|
|
|
|
|
|
bb15:
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp83 = load i64*, i64** %tmp82, align 4
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp85 = getelementptr inbounds i64, i64* %tmp83, i32 %i
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp86 = load i64, i64* %tmp85, align 4
|
|
|
|
%tmp91 = load i64*, i64** %tmp90, align 4
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp93 = getelementptr inbounds i64, i64* %tmp91, i32 %i
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp94 = load i64, i64* %tmp93, align 4
|
2010-04-12 02:21:50 +00:00
|
|
|
%tmp95 = icmp ult i64 %tmp86, %tmp94
|
|
|
|
br i1 %tmp95, label %bb20.loopexit, label %bb17
|
|
|
|
|
|
|
|
bb17:
|
|
|
|
%tmp97 = add nsw i32 %i, -1
|
|
|
|
br label %bb18
|
|
|
|
|
|
|
|
bb18:
|
|
|
|
%i = phi i32 [ %tmp2.i1, %entry ], [ %tmp97, %bb17 ]
|
|
|
|
%tmp99 = icmp sgt i32 %i, -1
|
|
|
|
br i1 %tmp99, label %bb13, label %bb20.loopexit
|
|
|
|
|
|
|
|
bb20.loopexit:
|
|
|
|
%tmp.0.ph = phi i32 [ 0, %bb18 ], [ 1, %bb15 ], [ 0, %bb13 ]
|
|
|
|
ret i32 %tmp.0.ph
|
|
|
|
}
|
2010-04-19 21:48:58 +00:00
|
|
|
|
|
|
|
; Indvars should eliminate the icmp here.
|
|
|
|
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @func_10(
|
2010-04-19 21:48:58 +00:00
|
|
|
; CHECK-NOT: icmp
|
|
|
|
; CHECK: ret void
|
|
|
|
|
|
|
|
define void @func_10() nounwind {
|
|
|
|
entry:
|
|
|
|
br label %loop
|
|
|
|
|
|
|
|
loop:
|
|
|
|
%i = phi i32 [ %i.next, %loop ], [ 0, %entry ]
|
|
|
|
%t0 = icmp slt i32 %i, 0
|
|
|
|
%t1 = zext i1 %t0 to i32
|
|
|
|
%t2 = add i32 %t1, %i
|
|
|
|
%u3 = zext i32 %t2 to i64
|
|
|
|
store i64 %u3, i64* null
|
|
|
|
%i.next = add i32 %i, 1
|
|
|
|
br i1 undef, label %loop, label %return
|
|
|
|
|
|
|
|
return:
|
|
|
|
ret void
|
|
|
|
}
|
2012-11-27 18:16:32 +00:00
|
|
|
|
|
|
|
; PR14432
|
|
|
|
; Indvars should not turn the second loop into an infinite one.
|
|
|
|
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @func_11(
|
2012-11-27 18:16:32 +00:00
|
|
|
; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
|
|
|
|
; CHECK-NOT: br i1 true, label %noassert68, label %unrolledend
|
|
|
|
|
|
|
|
define i32 @func_11() nounwind uwtable {
|
|
|
|
entry:
|
|
|
|
br label %forcond
|
|
|
|
|
|
|
|
forcond: ; preds = %noassert, %entry
|
|
|
|
%__key6.0 = phi i32 [ 2, %entry ], [ %tmp37, %noassert ]
|
|
|
|
%tmp5 = icmp slt i32 %__key6.0, 10
|
|
|
|
br i1 %tmp5, label %noassert, label %forcond38.preheader
|
|
|
|
|
|
|
|
forcond38.preheader: ; preds = %forcond
|
|
|
|
br label %forcond38
|
|
|
|
|
|
|
|
noassert: ; preds = %forbody
|
|
|
|
%tmp13 = sdiv i32 -32768, %__key6.0
|
|
|
|
%tmp2936 = shl i32 %tmp13, 24
|
|
|
|
%sext23 = shl i32 %tmp13, 24
|
|
|
|
%tmp32 = icmp eq i32 %tmp2936, %sext23
|
|
|
|
%tmp37 = add i32 %__key6.0, 1
|
|
|
|
br i1 %tmp32, label %forcond, label %assert33
|
|
|
|
|
|
|
|
assert33: ; preds = %noassert
|
|
|
|
tail call void @llvm.trap()
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
forcond38: ; preds = %noassert68, %forcond38.preheader
|
|
|
|
%__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
|
|
|
|
%tmp46 = icmp slt i32 %__key8.0, 10
|
|
|
|
br i1 %tmp46, label %noassert68, label %unrolledend
|
|
|
|
|
|
|
|
noassert68: ; preds = %forbody39
|
|
|
|
%tmp57 = sdiv i32 -32768, %__key8.0
|
|
|
|
%sext34 = shl i32 %tmp57, 16
|
|
|
|
%sext21 = shl i32 %tmp57, 16
|
|
|
|
%tmp76 = icmp eq i32 %sext34, %sext21
|
|
|
|
%tmp81 = add i32 %__key8.0, 1
|
|
|
|
br i1 %tmp76, label %forcond38, label %assert77
|
|
|
|
|
|
|
|
assert77: ; preds = %noassert68
|
|
|
|
tail call void @llvm.trap()
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
unrolledend: ; preds = %forcond38
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.trap() noreturn nounwind
|
2012-11-29 19:07:57 +00:00
|
|
|
|
|
|
|
; In this case the second loop only has a single iteration, fold the header away
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @func_12(
|
2012-11-29 19:07:57 +00:00
|
|
|
; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
|
|
|
|
; CHECK: br i1 true, label %noassert68, label %unrolledend
|
|
|
|
define i32 @func_12() nounwind uwtable {
|
|
|
|
entry:
|
|
|
|
br label %forcond
|
|
|
|
|
|
|
|
forcond: ; preds = %noassert, %entry
|
|
|
|
%__key6.0 = phi i32 [ 2, %entry ], [ %tmp37, %noassert ]
|
|
|
|
%tmp5 = icmp slt i32 %__key6.0, 10
|
|
|
|
br i1 %tmp5, label %noassert, label %forcond38.preheader
|
|
|
|
|
|
|
|
forcond38.preheader: ; preds = %forcond
|
|
|
|
br label %forcond38
|
|
|
|
|
|
|
|
noassert: ; preds = %forbody
|
|
|
|
%tmp13 = sdiv i32 -32768, %__key6.0
|
|
|
|
%tmp2936 = shl i32 %tmp13, 24
|
|
|
|
%sext23 = shl i32 %tmp13, 24
|
|
|
|
%tmp32 = icmp eq i32 %tmp2936, %sext23
|
|
|
|
%tmp37 = add i32 %__key6.0, 1
|
|
|
|
br i1 %tmp32, label %forcond, label %assert33
|
|
|
|
|
|
|
|
assert33: ; preds = %noassert
|
|
|
|
tail call void @llvm.trap()
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
forcond38: ; preds = %noassert68, %forcond38.preheader
|
|
|
|
%__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
|
|
|
|
%tmp46 = icmp slt i32 %__key8.0, 10
|
|
|
|
br i1 %tmp46, label %noassert68, label %unrolledend
|
|
|
|
|
|
|
|
noassert68: ; preds = %forbody39
|
|
|
|
%tmp57 = sdiv i32 -32768, %__key8.0
|
|
|
|
%sext34 = shl i32 %tmp57, 16
|
|
|
|
%sext21 = shl i32 %tmp57, 16
|
|
|
|
%tmp76 = icmp ne i32 %sext34, %sext21
|
|
|
|
%tmp81 = add i32 %__key8.0, 1
|
|
|
|
br i1 %tmp76, label %forcond38, label %assert77
|
|
|
|
|
|
|
|
assert77: ; preds = %noassert68
|
|
|
|
tail call void @llvm.trap()
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
unrolledend: ; preds = %forcond38
|
|
|
|
ret i32 0
|
|
|
|
}
|