[llvm] r286119 - Add -O0 support for @llvm.invariant.group.barrier by discarding it if it gets to ISel.

Richard Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 08:47:21 PST 2016


Author: rsmith
Date: Mon Nov  7 10:47:20 2016
New Revision: 286119

URL: http://llvm.org/viewvc/llvm-project?rev=286119&view=rev
Log:
Add -O0 support for @llvm.invariant.group.barrier by discarding it if it gets to ISel.

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

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/trunk/test/CodeGen/Generic/intrinsics.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=286119&r1=286118&r2=286119&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Nov  7 10:47:20 2016
@@ -1216,6 +1216,7 @@ bool FastISel::selectIntrinsicCall(const
     updateValueMap(II, ResultReg);
     return true;
   }
+  case Intrinsic::invariant_group_barrier:
   case Intrinsic::expect: {
     unsigned ResultReg = getRegForValue(II->getArgOperand(0));
     if (!ResultReg)

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=286119&r1=286118&r2=286119&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Nov  7 10:47:20 2016
@@ -5460,6 +5460,7 @@ SelectionDAGBuilder::visitIntrinsicCall(
   }
   case Intrinsic::annotation:
   case Intrinsic::ptr_annotation:
+  case Intrinsic::invariant_group_barrier:
     // Drop the intrinsic, but forward the value
     setValue(&I, getValue(I.getOperand(0)));
     return nullptr;

Modified: llvm/trunk/test/CodeGen/Generic/intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/intrinsics.ll?rev=286119&r1=286118&r2=286119&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/intrinsics.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/intrinsics.ll Mon Nov  7 10:47:20 2016
@@ -1,4 +1,5 @@
 ; RUN: llc < %s
+; RUN: llc -O0 < %s
 
 ;; SQRT
 declare float @llvm.sqrt.f32(float)
@@ -38,3 +39,9 @@ define double @test_cos(float %F) {
         ret double %I
 }
 
+declare i8* @llvm.invariant.group.barrier(i8*)
+
+define i8* @barrier(i8* %p) {
+        %q = call i8* @llvm.invariant.group.barrier(i8* %p)
+        ret i8* %q
+}




More information about the llvm-commits mailing list