]> granicus.if.org Git - llvm/commitdiff
[CFLGraph] Add support for unary fneg instruction.
authorCraig Topper <craig.topper@intel.com>
Thu, 6 Jun 2019 19:21:23 +0000 (19:21 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 6 Jun 2019 19:21:23 +0000 (19:21 +0000)
Differential Revision: https://reviews.llvm.org/D62791

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

lib/Analysis/CFLGraph.h
test/Analysis/CFLAliasAnalysis/Steensgaard/must-and-partial.ll

index cd7c2df8041b3cfc97697488aacd6f51e2e43815..21842ed364876e6cb9279dd0f9b0fceec1807cb7 100644 (file)
@@ -291,6 +291,11 @@ template <typename CFLAA> class CFLGraphBuilder {
       addAssignEdge(Op2, &Inst);
     }
 
+    void visitUnaryOperator(UnaryOperator &Inst) {
+      auto *Src = Inst.getOperand(0);
+      addAssignEdge(Src, &Inst);
+    }
+
     void visitAtomicCmpXchgInst(AtomicCmpXchgInst &Inst) {
       auto *Ptr = Inst.getPointerOperand();
       auto *Val = Inst.getNewValOperand();
@@ -579,6 +584,11 @@ template <typename CFLAA> class CFLGraphBuilder {
         break;
       }
 
+      case Instruction::FNeg: {
+        addAssignEdge(CE->getOperand(0), CE);
+        break;
+      }
+
       default:
         llvm_unreachable("Unknown instruction type encountered!");
       }
index cc03870b79485cce863199b3ce1c5ed3dda5a8a1..b1f96220662a22787baa4b722bfb65700a332e39 100644 (file)
@@ -49,6 +49,7 @@ define void @testr2(double* nocapture readonly %A, double* nocapture readonly %I
   %1 = load double, double* %arrayidx22
   %arrayidx25 = getelementptr inbounds double, double* %A, i64 2
   %2 = load double, double* %arrayidx25
-  %mul26 = fmul double %1, %2
+  %3 = fneg double %1
+  %mul26 = fmul double %3, %2
   ret void
 }