Page MenuHomePhabricator

TOCK (TOCK Chiu)
User

Projects

User does not belong to any projects.

User Details

User Since
Mar 13 2020, 4:45 AM (44 w, 4 d)

Recent Activity

Nov 29 2020

TOCK updated the diff for D88399: [TableGen] AsmMatcher: fix OpIdx of tied operands when HasOptionalOperands is true.

Include full context.

Nov 29 2020, 7:35 PM · Restricted Project
TOCK added a comment to D76127: [TableGen] Do not set ReadOnly attribute on intrinsics with side effects.

@danilaml
+1. It looks like a workaround at the moment.

Nov 29 2020, 7:23 PM · Restricted Project
TOCK updated the diff for D76127: [TableGen] Do not set ReadOnly attribute on intrinsics with side effects.

Include context as @danilaml suggested.

Nov 29 2020, 7:12 PM · Restricted Project

Nov 26 2020

TOCK added a comment to D76127: [TableGen] Do not set ReadOnly attribute on intrinsics with side effects.

The diffs lack context.

This patch is some kind of follow-up of D64414, which make TableGen stop emitting Attribute::ReadNone for IntrNoMem if such intrinsic is marked as IntrHasSideEffects. This patch does the same for other cases like IntrReadMem.

Nov 26 2020, 6:12 PM · Restricted Project

Sep 28 2020

TOCK added a reviewer for D76127: [TableGen] Do not set ReadOnly attribute on intrinsics with side effects: arsenm.
Sep 28 2020, 3:38 AM · Restricted Project
TOCK requested review of D88399: [TableGen] AsmMatcher: fix OpIdx of tied operands when HasOptionalOperands is true.
Sep 28 2020, 3:33 AM · Restricted Project

Mar 15 2020

TOCK added a comment to D76127: [TableGen] Do not set ReadOnly attribute on intrinsics with side effects.

For example, say we have these intrinsics:

def int_test_no_mem_v : Intrinsic<[], [llvm_i64_ty], [IntrNoMem, IntrHasSideEffects]>;
def int_test_read_mem_v : Intrinsic<[], [llvm_i64_ty], [IntrReadMem, IntrHasSideEffects]>;
def int_test_no_mem : Intrinsic<[llvm_i64_ty], [llvm_i64_ty], [IntrNoMem, IntrHasSideEffects]>;
def int_test_read_mem : Intrinsic<[llvm_i64_ty], [llvm_i64_ty], [IntrReadMem, IntrHasSideEffects]>;

Following code:

define i64 @foo(i64 %a, i64 %b) {
entry:
  call void @llvm.test.no.mem.v(i64 %a)
  call void @llvm.test.no.mem.v(i64 %a)
  call void @llvm.test.read.mem.v(i64 %b)
  call void @llvm.test.read.mem.v(i64 %b)
  %r1 = call i64 @llvm.test.no.mem(i64 %a)
  %r3 = call i64 @llvm.test.no.mem(i64 %a)
  %r2 = call i64 @llvm.test.read.mem(i64 %b)
  %r4 = call i64 @llvm.test.read.mem(i64 %b)
  %r12 = add nsw i64 %r1, %r2
  %r34 = add nsw i64 %r3, %r4
  %r14 = add nsw i64 %r12, %r34
  ret i64 %r14
}
declare void @llvm.test.no.mem.v(i64)
declare void @llvm.test.read.mem.v(i64)
declare i64 @llvm.test.no.mem(i64)
declare i64 @llvm.test.read.mem(i64)

would be optimized into:

define i64 @foo(i64 %a, i64 %b) local_unnamed_addr #0 {
entry:
  tail call void @llvm.test.no.mem.v(i64 %a)
  tail call void @llvm.test.no.mem.v(i64 %a)
  %r1 = tail call i64 @llvm.test.no.mem(i64 %a)
  %r3 = tail call i64 @llvm.test.no.mem(i64 %a)
  %r2 = tail call i64 @llvm.test.read.mem(i64 %b)
  %factor = shl i64 %r2, 1
  %r12 = add i64 %r3, %r1
  %r14 = add i64 %r12, %factor
  ret i64 %r14
}
...

Calls to @llvm.test.read.mem.v are removed completely (this is what D64414 tried to address), also one call to @llvm.test.read.mem is removed:

EarlyCSE DCE:   call void @llvm.test.read.mem.v(i64 %b)                                                                                           
EarlyCSE DCE:   call void @llvm.test.read.mem.v(i64 %b)                                                                                           
EarlyCSE CSE CALL:   %r4 = call i64 @llvm.test.read.mem(i64 %b)  to:   %r2 = call i64 @llvm.test.read.mem(i64 %b)                                 
        discovered a new reachable node %entry

This is due to the fact that TableGen doesn't respect IntrHasSideEffects, and make it read only:

...
    case 52: {
      const Attribute::AttrKind Atts[] = {Attribute::NoUnwind,Attribute::ReadOnly};
      AS[0] = AttributeList::get(C, AttributeList::FunctionIndex, Atts);
      NumAttrs = 1;
      break;
      }
...
Mar 15 2020, 8:56 PM · Restricted Project

Mar 13 2020

TOCK created D76127: [TableGen] Do not set ReadOnly attribute on intrinsics with side effects.
Mar 13 2020, 5:46 AM · Restricted Project