[llvm-commits] patch: CXAGuardElimination pass.
Duncan Sands
baldrick at free.fr
Mon May 25 00:58:35 PDT 2009
Hi Nick,
> + CallInst *A = dyn_cast<CallInst>(I);
> + if (!A) continue;
> +
> + // TODO: __cxa_guard_acquire returns a value, then makes a conditional
> + // branch off of it. We need to handle this.
the acquire function may be being passed as a parameter to some other
function rather than being called.
> + if (I->mayReadFromMemory() || I->mayWriteToMemory())
Maybe you should use mayHaveSideEffects rather than mayWriteToMemory,
since a "const" function can still throw an exception. On the other
hand, since such a function doesn't read or write memory it shouldn't
need to be wrapped in guards anyway.
> +BasicBlock *CXAGuardElimination::getUniqueSuccessor(TerminatorInst *TI,
> + CallInst *Acquire) {
> + if (TI->getNumSuccessors() == 1)
> + return TI->getSuccessor(0);
What about this:
bb1: acquire
br bbr
bb2: acquire
br bbr
bbr: release
Aren't you going to eliminate the first acquire and the release, but
not the second acquire?
> + addPass(PM, createCXAGuardEliminationPass()); // Remove __cxa_guard_* calls.
Are you going to add this to llvm-gcc too?
> + This pass deletes dead calls to __cxa_guard_acquire and __cxa_guard_release
> + which are part of the Itanium C++ ABI. T hese are used to prevent a function
T hese -> These
Ciao,
Duncan.
More information about the llvm-commits
mailing list