diff options
| author | Davide Italiano <davide@freebsd.org> | 2016-12-09 03:08:42 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2016-12-09 03:08:42 +0000 |
| commit | 824d6952310f6fa127cd14efb52017adc8d058f3 (patch) | |
| tree | aa64f665af6412576927f7ecfa0114baaa52fcc4 /llvm/test | |
| parent | e3a0aef2cf93c7dc144c52798aa5546dc5ec304b (diff) | |
| download | bcm5719-llvm-824d6952310f6fa127cd14efb52017adc8d058f3.tar.gz bcm5719-llvm-824d6952310f6fa127cd14efb52017adc8d058f3.zip | |
[SCCP] Teach the pass about `mul %x 0` even if %x is overdefined.
The motivating example is:
extern int patatino;
int goo() {
int x = 0;
for (int i = 0; i < 1000000; ++i) {
x *= patatino;
}
return x;
}
Currently SCCP will not realize that this function returns always zero,
therefore will try to unroll and vectorize the loop at -O3 producing an
awful lot of (useless) code. With this change, it will just produce:
0000000000000000 <g>:
xor %eax,%eax
retq
llvm-svn: 289175
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/SCCP/logical-nuke.ll | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/test/Transforms/SCCP/logical-nuke.ll b/llvm/test/Transforms/SCCP/logical-nuke.ll index 4ef52a25539..76884dbab4b 100644 --- a/llvm/test/Transforms/SCCP/logical-nuke.ll +++ b/llvm/test/Transforms/SCCP/logical-nuke.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -sccp -S | FileCheck %s -; Test that SCCP has basic knowledge of when and/or nuke overdefined values. +; Test that SCCP has basic knowledge of when and/or/mul nuke overdefined values. ; CHECK-LABEL: test ; CHECK: ret i32 0 @@ -29,3 +29,10 @@ define i32 @test4(i32 %X) { %Y = or i32 %X, undef ret i32 %Y } + +; CHECK-LABEL: test5 +; CHECK: ret i32 0 +define i32 @test5(i32 %foo) { + %patatino = mul i32 %foo, undef + ret i32 %patatino +} |

