JonPsson1 wrote:

ok, will try to fix those one at a time: I think TypeSanitizer is ok now: 
https://github.com/llvm/llvm-project/pull/224366

When I removed isInternal(), compiler-rt did not even build as the buildgo.sh 
script now failed. It seems that ArgumentPromotionPass will change an internal 
function to receive a loaded value directly instead of the pointer:

```
define dso_local void @_Z8AddStackv() local_unnamed_addr #0 {
entry:
  %agg.tmp = alloca %struct.StackTrace, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 
dereferenceable(16) %agg.tmp, ptr noundef nonnull align 8 dereferenceable(16) 
@AddStack_stack, i64 16, i1 false), !tbaa.struct !7
  %call = call fastcc noundef ptr @_ZL14SymbolizeStack10StackTrace(ptr 
nofreeobj noundef align 8 dead_on_return dereferenceable(16) %agg.tmp)
  unreachable
}

define internal fastcc noundef ptr @_ZL14SymbolizeStack10StackTrace(ptr 
nofreeobj noundef nonnull readonly align 8 captures(none) dead_on_return 
dereferenceable(16) %trace) unnamed_addr #0 {
entry:
  br label %for.cond

for.cond:                                         ; preds = %for.cond, %entry
  %si.0 = phi i64 [ undef, %entry ], [ %inc, %for.cond ]
  %size = getelementptr inbounds nuw i8, ptr %trace, i64 8
  %0 = load i32, ptr %size, align 8, !tbaa !17
  %conv = sext i32 %0 to i64
  %cmp = icmp slt i64 %si.0, %conv
  call void @llvm.assume(i1 %cmp)
  call void @_Z13SymbolizeCodev()
  %inc = add nsw i64 %si.0, 1
  br label %for.cond, !llvm.loop !19
}

; *** IR Dump After ArgumentPromotionPass on (_ZL14SymbolizeStack10StackTrace) 
***
; Function Attrs: mustprogress
define internal fastcc noundef ptr @_ZL14SymbolizeStack10StackTrace(i32 
%trace.8.val) unnamed_addr #0 {
entry:
  br label %for.cond

for.cond:                                         ; preds = %for.cond, %entry
  %si.0 = phi i64 [ undef, %entry ], [ %inc, %for.cond ]
  %conv = sext i32 %trace.8.val to i64
  %cmp = icmp slt i64 %si.0, %conv
  call void @llvm.assume(i1 %cmp)
  call void @_Z13SymbolizeCodev()
  %inc = add nsw i64 %si.0, 1
  br label %for.cond, !llvm.loop !19
}

; Function Attrs: mustprogress
define dso_local void @_Z8AddStackv() local_unnamed_addr #0 {
entry:
  %agg.tmp = alloca %struct.StackTrace, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 
dereferenceable(16) %agg.tmp, ptr noundef nonnull align 8 dereferenceable(16) 
@AddStack_stack, i64 16, i1 false), !tbaa.struct !7
  %0 = getelementptr i8, ptr %agg.tmp, i64 8
  %agg.tmp.val = load i32, ptr %0, align 8
  %1 = call fastcc noundef ptr @_ZL14SymbolizeStack10StackTrace(i32 
%agg.tmp.val)
  unreachable
}

```

So the question becomes what attribute to add... I might give it a "NoExt" as 
it is just a loaded i32, but I guess any extension would be harmless, or?


https://github.com/llvm/llvm-project/pull/223755
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to