Deleted Added
full compact
GCStrategy.cpp (208954) GCStrategy.cpp (210299)
1//===-- GCStrategy.cpp - Garbage collection infrastructure -----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 257 unchanged lines hidden (view full) ---

266 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
267 for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) {
268 if (IntrinsicInst *CI = dyn_cast<IntrinsicInst>(II++)) {
269 Function *F = CI->getCalledFunction();
270 switch (F->getIntrinsicID()) {
271 case Intrinsic::gcwrite:
272 if (LowerWr) {
273 // Replace a write barrier with a simple store.
1//===-- GCStrategy.cpp - Garbage collection infrastructure -----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 257 unchanged lines hidden (view full) ---

266 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
267 for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) {
268 if (IntrinsicInst *CI = dyn_cast<IntrinsicInst>(II++)) {
269 Function *F = CI->getCalledFunction();
270 switch (F->getIntrinsicID()) {
271 case Intrinsic::gcwrite:
272 if (LowerWr) {
273 // Replace a write barrier with a simple store.
274 Value *St = new StoreInst(CI->getOperand(1), CI->getOperand(3), CI);
274 Value *St = new StoreInst(CI->getArgOperand(0), CI->getArgOperand(2), CI);
275 CI->replaceAllUsesWith(St);
276 CI->eraseFromParent();
277 }
278 break;
279 case Intrinsic::gcread:
280 if (LowerRd) {
281 // Replace a read barrier with a simple load.
275 CI->replaceAllUsesWith(St);
276 CI->eraseFromParent();
277 }
278 break;
279 case Intrinsic::gcread:
280 if (LowerRd) {
281 // Replace a read barrier with a simple load.
282 Value *Ld = new LoadInst(CI->getOperand(2), "", CI);
282 Value *Ld = new LoadInst(CI->getArgOperand(1), "", CI);
283 Ld->takeName(CI);
284 CI->replaceAllUsesWith(Ld);
285 CI->eraseFromParent();
286 }
287 break;
288 case Intrinsic::gcroot:
289 if (InitRoots) {
290 // Initialize the GC root, but do not delete the intrinsic. The
291 // backend needs the intrinsic to flag the stack slot.
292 Roots.push_back(cast<AllocaInst>(
283 Ld->takeName(CI);
284 CI->replaceAllUsesWith(Ld);
285 CI->eraseFromParent();
286 }
287 break;
288 case Intrinsic::gcroot:
289 if (InitRoots) {
290 // Initialize the GC root, but do not delete the intrinsic. The
291 // backend needs the intrinsic to flag the stack slot.
292 Roots.push_back(cast<AllocaInst>(
293 CI->getOperand(1)->stripPointerCasts()));
293 CI->getArgOperand(0)->stripPointerCasts()));
294 }
295 break;
296 default:
297 continue;
298 }
299
300 MadeChange = true;
301 }

--- 96 unchanged lines hidden ---
294 }
295 break;
296 default:
297 continue;
298 }
299
300 MadeChange = true;
301 }

--- 96 unchanged lines hidden ---