diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-05-06 11:46:36 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-05-18 10:52:30 -0700 |
commit | 2c3e0051c31c3f5b2328b447eadf1cf9c4427442 (patch) | |
tree | c0104029af14e9f47c2ef58ca60e6137691f3c9b /test/CodeGen/X86/dag-optnone.ll | |
parent | e1bc145815f4334641be19f1c45ecf85d25b6e5a (diff) | |
download | external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.zip external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.tar.gz external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.tar.bz2 |
Update aosp/master LLVM for rebase to r235153
Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7
(cherry picked from commit 0c7f116bb6950ef819323d855415b2f2b0aad987)
Diffstat (limited to 'test/CodeGen/X86/dag-optnone.ll')
-rw-r--r-- | test/CodeGen/X86/dag-optnone.ll | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/CodeGen/X86/dag-optnone.ll b/test/CodeGen/X86/dag-optnone.ll new file mode 100644 index 0000000..f7774e6 --- /dev/null +++ b/test/CodeGen/X86/dag-optnone.ll @@ -0,0 +1,73 @@ +; RUN: llc < %s -mtriple=x86_64-pc-win32 -O0 -mattr=+avx | FileCheck %s + +; Background: +; If fast-isel bails out to normal selection, then the DAG combiner will run, +; even at -O0. In principle this should not happen (those are optimizations, +; and we said -O0) but as a practical matter there are some instruction +; selection patterns that depend on the legalizations and transforms that the +; DAG combiner does. +; +; The 'optnone' attribute implicitly sets -O0 and fast-isel for the function. +; The DAG combiner was disabled for 'optnone' (but not -O0) by r221168, then +; re-enabled in r233153 because of problems with instruction selection patterns +; mentioned above. (Note: because 'optnone' is supposed to match -O0, r221168 +; really should have disabled the combiner for both.) +; +; If instruction selection eventually becomes smart enough to run without DAG +; combiner, then the combiner can be turned off for -O0 (not just 'optnone') +; and this test can go away. (To be replaced by a different test that verifies +; the DAG combiner does *not* run at -O0 or for 'optnone' functions.) +; +; In the meantime, this test wants to make sure the combiner stays enabled for +; 'optnone' functions, just as it is for -O0. + + +; The test cases @foo[WithOptnone] prove that the same DAG combine happens +; with -O0 and with 'optnone' set. To prove this, we use a Windows triple to +; cause fast-isel to bail out (because something about the calling convention +; is not handled in fast-isel). Then we have a repeated fadd that can be +; combined into an fmul. We show that this happens in both the non-optnone +; function and the optnone function. + +define float @foo(float %x) #0 { +entry: + %add = fadd fast float %x, %x + %add1 = fadd fast float %add, %x + ret float %add1 +} + +; CHECK-LABEL: @foo +; CHECK-NOT: add +; CHECK: mul +; CHECK-NEXT: ret + +define float @fooWithOptnone(float %x) #1 { +entry: + %add = fadd fast float %x, %x + %add1 = fadd fast float %add, %x + ret float %add1 +} + +; CHECK-LABEL: @fooWithOptnone +; CHECK-NOT: add +; CHECK: mul +; CHECK-NEXT: ret + + +; The test case @bar is derived from an instruction selection failure case +; that was solved by r233153. It depends on -mattr=+avx. +; Really all we're trying to prove is that it doesn't crash any more. + +@id84 = common global <16 x i32> zeroinitializer, align 64 + +define void @bar() #1 { +entry: + %id83 = alloca <16 x i8>, align 16 + %0 = load <16 x i32>, <16 x i32>* @id84, align 64 + %conv = trunc <16 x i32> %0 to <16 x i8> + store <16 x i8> %conv, <16 x i8>* %id83, align 16 + ret void +} + +attributes #0 = { "unsafe-fp-math"="true" } +attributes #1 = { noinline optnone "unsafe-fp-math"="true" } |