diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-01-19 16:59:46 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-01-19 16:59:46 +0000 |
commit | 30aa8b13c93211f68bb4efddd1e47817a1d107f1 (patch) | |
tree | 7ade38c10f647ed959557a49079469439b416548 /test/Analysis | |
parent | 3abd75bf1dc96ee0cd7e8c1b8331e27672437b8b (diff) | |
download | external_llvm-30aa8b13c93211f68bb4efddd1e47817a1d107f1.zip external_llvm-30aa8b13c93211f68bb4efddd1e47817a1d107f1.tar.gz external_llvm-30aa8b13c93211f68bb4efddd1e47817a1d107f1.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/ScalarEvolution/fold.ll | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/Analysis/ScalarEvolution/fold.ll b/test/Analysis/ScalarEvolution/fold.ll index 202ddd4..f46c691 100644 --- a/test/Analysis/ScalarEvolution/fold.ll +++ b/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 +} |