[LICM] Support unary FNeg in LICM
authorCameron McInally <cameron.mcinally@nyu.edu>
Thu, 8 Aug 2019 21:38:31 +0000 (21:38 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Thu, 8 Aug 2019 21:38:31 +0000 (21:38 +0000)
Differential Revision: https://reviews.llvm.org/D65908

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368350 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/hoisting.ll

index e018eb688e05436b42c56737f8ad31dd27e76ced..572b69fb89005904267756e763c64d2c37b33097 100644 (file)
@@ -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) ||
index eebe1ea7d6457cffb4ccb06d4eef3da25b07169d..97609fa397e45a79a4ed951dfdba755fb05ecc4b 100644 (file)
@@ -127,9 +127,8 @@ ifend:                                            ; preds = %tailrecurse
 }
 
 ; 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