summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/ScalarEvolution/fold.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-01-19 16:59:46 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-01-19 16:59:46 +0000
commit5143f0f09b8f3e1c3160215ef5feaf032677b223 (patch)
treefe6466b3b094eb2e298ab96c85c2aa63f21c5db6 /llvm/test/Analysis/ScalarEvolution/fold.ll
parentd6335ce508ccb9f9369a08f4ae822f2aab5d0009 (diff)
downloadbcm5719-llvm-5143f0f09b8f3e1c3160215ef5feaf032677b223.tar.gz
bcm5719-llvm-5143f0f09b8f3e1c3160215ef5feaf032677b223.zip
Add a missed SCEV fold that is required to continue analyzing the IR produced
by indvars through the scev expander. trunc(add x, y) --> add(trunc x, y). Currently SCEV largely folds the other way which is probably wrong, but preserved to minimize churn. Instcombine doesn't do this fold either, demonstrating a missed optz'n opportunity on code doing add+trunc+add. llvm-svn: 123838
Diffstat (limited to 'llvm/test/Analysis/ScalarEvolution/fold.ll')
-rw-r--r--llvm/test/Analysis/ScalarEvolution/fold.ll10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/fold.ll b/llvm/test/Analysis/ScalarEvolution/fold.ll
index 202ddd4169a..f46c691f46f 100644
--- a/llvm/test/Analysis/ScalarEvolution/fold.ll
+++ b/llvm/test/Analysis/ScalarEvolution/fold.ll
@@ -1,8 +1,16 @@
; RUN: opt -analyze -scalar-evolution %s -S | FileCheck %s
-define i16 @test(i8 %x) {
+define i16 @test1(i8 %x) {
%A = zext i8 %x to i12
%B = sext i12 %A to i16
; CHECK: zext i8 %x to i16
ret i16 %B
}
+
+define i8 @test2(i8 %x) {
+ %A = zext i8 %x to i16
+ %B = add i16 %A, 1025
+ %C = trunc i16 %B to i8
+; CHECK: (1 + %x)
+ ret i8 %C
+}
OpenPOWER on IntegriCloud