@@ -1868,31 +1868,6 @@ Value *LateLowerGCFrame::EmitLoadTag(IRBuilder<> &builder, Type *T_size, Value *
1868
1868
return load;
1869
1869
}
1870
1870
1871
- // Enable this optimization only on LLVM 4.0+ since this cause LLVM to optimize
1872
- // constant store loop to produce a `memset_pattern16` with a global variable
1873
- // that's initialized by `addrspacecast`. Such a global variable is not supported by the backend.
1874
- // This is not a problem on 4.0+ since that transformation (in loop-idiom) is disabled
1875
- // for NI pointers.
1876
- static SmallVector<int , 1 > *FindRefinements (Value *V, State *S)
1877
- {
1878
- if (!S)
1879
- return nullptr ;
1880
- auto it = S->AllPtrNumbering .find (V);
1881
- if (it == S->AllPtrNumbering .end ())
1882
- return nullptr ;
1883
- auto rit = S->Refinements .find (it->second );
1884
- return rit != S->Refinements .end () && !rit->second .empty () ? &rit->second : nullptr ;
1885
- }
1886
-
1887
- static bool IsPermRooted (Value *V, State *S)
1888
- {
1889
- if (isa<Constant>(V))
1890
- return true ;
1891
- if (auto *RefinePtr = FindRefinements (V, S))
1892
- return RefinePtr->size () == 1 && (*RefinePtr)[0 ] == -2 ;
1893
- return false ;
1894
- }
1895
-
1896
1871
static inline void UpdatePtrNumbering (Value *From, Value *To, State *S)
1897
1872
{
1898
1873
if (!S)
@@ -1911,50 +1886,6 @@ MDNode *createMutableTBAAAccessTag(MDNode *Tag) {
1911
1886
return MDBuilder (Tag->getContext ()).createMutableTBAAAccessTag (Tag);
1912
1887
}
1913
1888
1914
- void LateLowerGCFrame::CleanupWriteBarriers (Function &F, State *S, const SmallVector<CallInst*, 0 > &WriteBarriers, bool *CFGModified) {
1915
- auto T_size = F.getParent ()->getDataLayout ().getIntPtrType (F.getContext ());
1916
- for (auto CI : WriteBarriers) {
1917
- auto parent = CI->getArgOperand (0 );
1918
- if (std::all_of (CI->op_begin () + 1 , CI->op_end (),
1919
- [parent, &S](Value *child) { return parent == child || IsPermRooted (child, S); })) {
1920
- CI->eraseFromParent ();
1921
- continue ;
1922
- }
1923
- if (CFGModified) {
1924
- *CFGModified = true ;
1925
- }
1926
-
1927
- IRBuilder<> builder (CI);
1928
- builder.SetCurrentDebugLocation (CI->getDebugLoc ());
1929
- auto parBits = builder.CreateAnd (EmitLoadTag (builder, T_size, parent), GC_OLD_MARKED, " parent_bits" );
1930
- auto parOldMarked = builder.CreateICmpEQ (parBits, ConstantInt::get (T_size, GC_OLD_MARKED), " parent_old_marked" );
1931
- auto mayTrigTerm = SplitBlockAndInsertIfThen (parOldMarked, CI, false );
1932
- builder.SetInsertPoint (mayTrigTerm);
1933
- mayTrigTerm->getParent ()->setName (" may_trigger_wb" );
1934
- Value *anyChldNotMarked = NULL ;
1935
- for (unsigned i = 1 ; i < CI->arg_size (); i++) {
1936
- Value *child = CI->getArgOperand (i);
1937
- Value *chldBit = builder.CreateAnd (EmitLoadTag (builder, T_size, child), GC_MARKED, " child_bit" );
1938
- Value *chldNotMarked = builder.CreateICmpEQ (chldBit, ConstantInt::get (T_size, 0 ), " child_not_marked" );
1939
- anyChldNotMarked = anyChldNotMarked ? builder.CreateOr (anyChldNotMarked, chldNotMarked) : chldNotMarked;
1940
- }
1941
- assert (anyChldNotMarked); // handled by all_of test above
1942
- MDBuilder MDB (parent->getContext ());
1943
- SmallVector<uint32_t , 2 > Weights{1 , 9 };
1944
- auto trigTerm = SplitBlockAndInsertIfThen (anyChldNotMarked, mayTrigTerm, false ,
1945
- MDB.createBranchWeights (Weights));
1946
- trigTerm->getParent ()->setName (" trigger_wb" );
1947
- builder.SetInsertPoint (trigTerm);
1948
- if (CI->getCalledOperand () == write_barrier_func) {
1949
- builder.CreateCall (getOrDeclare (jl_intrinsics::queueGCRoot), parent);
1950
- }
1951
- else {
1952
- assert (false );
1953
- }
1954
- CI->eraseFromParent ();
1955
- }
1956
- }
1957
-
1958
1889
bool LateLowerGCFrame::CleanupIR (Function &F, State *S, bool *CFGModified) {
1959
1890
auto T_int32 = Type::getInt32Ty (F.getContext ());
1960
1891
auto T_size = F.getParent ()->getDataLayout ().getIntPtrType (F.getContext ());
0 commit comments