Skip to content

Commit

Permalink
Add -O0 support for @llvm.invariant.group.barrier by discarding it if…
Browse files Browse the repository at this point in the history
… it gets to ISel.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286119 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
zygoloid committed Nov 7, 2016
1 parent c6533e3 commit bbc0561
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/CodeGen/SelectionDAG/FastISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
updateValueMap(II, ResultReg);
return true;
}
case Intrinsic::invariant_group_barrier:
case Intrinsic::expect: {
unsigned ResultReg = getRegForValue(II->getArgOperand(0));
if (!ResultReg)
Expand Down
1 change: 1 addition & 0 deletions lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5460,6 +5460,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
}
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;
Expand Down
7 changes: 7 additions & 0 deletions test/CodeGen/Generic/intrinsics.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: llc < %s
; RUN: llc -O0 < %s

;; SQRT
declare float @llvm.sqrt.f32(float)
Expand Down Expand Up @@ -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
}

0 comments on commit bbc0561

Please sign in to comment.