[llvm] r368350 - [LICM] Support unary FNeg in LICM

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 14:38:31 PDT 2019


Author: mcinally
Date: Thu Aug  8 14:38:31 2019
New Revision: 368350

URL: http://llvm.org/viewvc/llvm-project?rev=368350&view=rev
Log:
[LICM] Support unary FNeg in LICM

Differential Revision: https://reviews.llvm.org/D65908

Modified:
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp
    llvm/trunk/test/Transforms/LICM/hoisting.ll

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=368350&r1=368349&r2=368350&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Thu Aug  8 14:38:31 2019
@@ -1032,7 +1032,8 @@ namespace {
 bool isHoistableAndSinkableInst(Instruction &I) {
   // Only these instructions are hoistable/sinkable.
   return (isa<LoadInst>(I) || isa<StoreInst>(I) || isa<CallInst>(I) ||
-          isa<FenceInst>(I) || isa<BinaryOperator>(I) || isa<CastInst>(I) ||
+          isa<FenceInst>(I) || isa<CastInst>(I) ||
+          isa<UnaryOperator>(I) || isa<BinaryOperator>(I) ||
           isa<SelectInst>(I) || isa<GetElementPtrInst>(I) || isa<CmpInst>(I) ||
           isa<InsertElementInst>(I) || isa<ExtractElementInst>(I) ||
           isa<ShuffleVectorInst>(I) || isa<ExtractValueInst>(I) ||

Modified: llvm/trunk/test/Transforms/LICM/hoisting.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/hoisting.ll?rev=368350&r1=368349&r2=368350&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/hoisting.ll (original)
+++ llvm/trunk/test/Transforms/LICM/hoisting.ll Thu Aug  8 14:38:31 2019
@@ -127,9 +127,8 @@ ifend:
 }
 
 ; CHECK: define void @test6(float %f)
-; CHECK: call
 ; CHECK: fneg
-; CHECK: call
+; CHECK: br label %for.body
 define void @test6(float %f) #2 {
 entry:
   br label %for.body




More information about the llvm-commits mailing list