Fix use after free (pr16103).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182482 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2013-05-22 15:31:11 +00:00
parent 431c73bc33
commit 812789dd3d

View File

@ -259,20 +259,35 @@ public:
}
void visitCallInst(CallInst &I) {
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.tex")
StringRef Name = I.getCalledFunction()->getName();
if (Name == "llvm.AMDGPU.tex") {
ReplaceTexIntrinsic(I, false, TexSign, "llvm.R600.tex", "llvm.R600.texc");
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.txl")
return;
}
if (Name == "llvm.AMDGPU.txl") {
ReplaceTexIntrinsic(I, true, TexSign, "llvm.R600.txl", "llvm.R600.txlc");
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.txb")
return;
}
if (Name == "llvm.AMDGPU.txb") {
ReplaceTexIntrinsic(I, true, TexSign, "llvm.R600.txb", "llvm.R600.txbc");
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.txf")
return;
}
if (Name == "llvm.AMDGPU.txf") {
ReplaceTXF(I);
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.txq")
return;
}
if (Name == "llvm.AMDGPU.txq") {
ReplaceTexIntrinsic(I, false, TexQSign, "llvm.R600.txq", "llvm.R600.txq");
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.ddx")
return;
}
if (Name == "llvm.AMDGPU.ddx") {
ReplaceTexIntrinsic(I, false, TexSign, "llvm.R600.ddx", "llvm.R600.ddx");
if (I.getCalledFunction()->getName() == "llvm.AMDGPU.ddy")
return;
}
if (Name == "llvm.AMDGPU.ddy") {
ReplaceTexIntrinsic(I, false, TexSign, "llvm.R600.ddy", "llvm.R600.ddy");
return;
}
}
};