[PATCH] D65908: Support unary FNeg in LICM

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 14:39:00 PDT 2019


cameron.mcinally created this revision.
cameron.mcinally added reviewers: spatel, arsenm, craig.scott, kpn, nicholas, nlewycky, reames.
Herald added subscribers: llvm-commits, asbirlea, jfb, hiraditya, wdng.
Herald added a project: LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D65908

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


Index: llvm/test/Transforms/LICM/hoisting.ll
===================================================================
--- llvm/test/Transforms/LICM/hoisting.ll
+++ llvm/test/Transforms/LICM/hoisting.ll
@@ -127,9 +127,8 @@
 }
 
 ; 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
Index: llvm/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LICM.cpp
+++ llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1026,7 +1026,8 @@
 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) ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65908.214007.patch
Type: text/x-patch
Size: 1201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190807/ad72ac88/attachment.bin>


More information about the llvm-commits mailing list