X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=CDSPass.cpp;h=6ec6dd2aac73a40aa28ec491a6a06004dfc112a3;hb=dbca9deee4a28c78ba855fddc3c0d1250e3475b2;hp=50aca18a5114b23a81b934e3cbe9e18c3bab03f1;hpb=106fed033350a4949d394fa72b2cd91d0f036e59;p=c11llvm.git diff --git a/CDSPass.cpp b/CDSPass.cpp index 50aca18..6ec6dd2 100644 --- a/CDSPass.cpp +++ b/CDSPass.cpp @@ -327,6 +327,7 @@ bool CDSPass::runOnFunction(Function &F) { bool Res = false; bool HasAtomic = false; + bool HasVolatile = false; const DataLayout &DL = F.getParent()->getDataLayout(); // errs() << "--- " << F.getName() << "---\n"; @@ -341,9 +342,10 @@ bool CDSPass::runOnFunction(Function &F) { StoreInst *SI = dyn_cast(&I); bool isVolatile = ( LI ? LI->isVolatile() : SI->isVolatile() ); - if (isVolatile) + if (isVolatile) { VolatileLoadsAndStores.push_back(&I); - else + HasVolatile = true; + } else LocalLoadsAndStores.push_back(&I); } else if (isa(I) || isa(I)) { // not implemented yet @@ -366,7 +368,7 @@ bool CDSPass::runOnFunction(Function &F) { } // only instrument functions that contain atomics - if (Res && HasAtomic) { + if (Res && ( HasAtomic || HasVolatile) ) { IRBuilder<> IRB(F.getEntryBlock().getFirstNonPHI()); /* Unused for now Value *ReturnAddress = IRB.CreateCall(