[llvm] r233183 - [optnone] Skip pass Float2Int on optnone functions.

Andrea Di Biagio Andrea_DiBiagio at sn.scee.net
Wed Mar 25 05:22:37 PDT 2015


Author: adibiagio
Date: Wed Mar 25 07:22:37 2015
New Revision: 233183

URL: http://llvm.org/viewvc/llvm-project?rev=233183&view=rev
Log:
[optnone] Skip pass Float2Int on optnone functions.

Added test Float2Int/float2int-optnone.ll to verify that pass Float2Int
is not run on optnone functions.

Added:
    llvm/trunk/test/Transforms/Float2Int/float2int-optnone.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/Float2Int.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/Float2Int.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Float2Int.cpp?rev=233183&r1=233182&r2=233183&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Float2Int.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Float2Int.cpp Wed Mar 25 07:22:37 2015
@@ -511,6 +511,9 @@ void Float2Int::cleanup() {
 }
 
 bool Float2Int::runOnFunction(Function &F) {
+  if (skipOptnoneFunction(F))
+    return false;
+
   DEBUG(dbgs() << "F2I: Looking at function " << F.getName() << "\n");
   // Clear out all state.
   ECs = EquivalenceClasses<Instruction*>();

Added: llvm/trunk/test/Transforms/Float2Int/float2int-optnone.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Float2Int/float2int-optnone.ll?rev=233183&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Float2Int/float2int-optnone.ll (added)
+++ llvm/trunk/test/Transforms/Float2Int/float2int-optnone.ll Wed Mar 25 07:22:37 2015
@@ -0,0 +1,17 @@
+; RUN: opt < %s -float2int -S | FileCheck %s
+;
+; Verify that pass float2int is not run on optnone functions.
+
+define i16 @simple1(i8 %a) #0 {
+; CHECK-LABEL: @simple1
+; CHECK:  %1 = uitofp i8 %a to float
+; CHECK-NEXT:  %2 = fadd float %1, 1.0
+; CHECK-NEXT:  %3 = fptoui float %2 to i16
+; CHECK-NEXT:  ret i16 %3
+  %1 = uitofp i8 %a to float
+  %2 = fadd float %1, 1.0
+  %3 = fptoui float %2 to i16
+  ret i16 %3
+}
+
+attributes #0 = { noinline optnone }





More information about the llvm-commits mailing list