From 759015d80f16064ba4197dd8c3b1a5a1d6f6fff2 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Wed, 25 Mar 2015 00:10:24 +0000 Subject: [PATCH] 'optnone' should not disable DAG combiner. Reverts the code change from r221168 and the relevant test. It was a mistake to disable the combiner, and based on the ultimate definition of 'optnone' we shouldn't have considered the test case as failing in the first place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233153 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 ---- test/CodeGen/X86/fastmath-optnone.ll | 35 ------------------------ 2 files changed, 40 deletions(-) delete mode 100644 test/CodeGen/X86/fastmath-optnone.ll diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 35554796416..dbdde4e2dcf 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1183,11 +1183,6 @@ void DAGCombiner::Run(CombineLevel AtLevel) { LegalOperations = Level >= AfterLegalizeVectorOps; LegalTypes = Level >= AfterLegalizeTypes; - // Early exit if this basic block is in an optnone function. - if (DAG.getMachineFunction().getFunction()->hasFnAttribute( - Attribute::OptimizeNone)) - return; - // Add all the dag nodes to the worklist. for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), E = DAG.allnodes_end(); I != E; ++I) diff --git a/test/CodeGen/X86/fastmath-optnone.ll b/test/CodeGen/X86/fastmath-optnone.ll deleted file mode 100644 index 0caadff8916..00000000000 --- a/test/CodeGen/X86/fastmath-optnone.ll +++ /dev/null @@ -1,35 +0,0 @@ -; RUN: llc < %s -mcpu=corei7 -march=x86-64 -mattr=+sse2 | FileCheck %s -; Verify that floating-point operations inside 'optnone' functions -; are not optimized even if unsafe-fp-math is set. - -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-NOT: add -; CHECK: 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: mul -; CHECK: add -; CHECK-NOT: mul -; CHECK: add -; CHECK-NOT: mul -; CHECK: ret - - -attributes #0 = { "unsafe-fp-math"="true" } -attributes #1 = { noinline optnone "unsafe-fp-math"="true" } -- 2.34.1