Speculatively harden the conversion logic. I have no idea if this will

help the dragonegg builders, and no test case at this point, but this
was one dimly plausible case I spotted by inspection. Hopefully will get
a testcase from those bots soon-ish, and will tidy this up with proper
testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165869 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth 2012-10-13 10:49:30 +00:00
parent 444dccecfc
commit ac104272d9

View File

@ -2358,11 +2358,22 @@ private:
return false;
if (!NewTy->isSingleValueType() || !OldTy->isSingleValueType())
return false;
if (NewTy->isPointerTy() || OldTy->isPointerTy()) {
if (NewTy->isPointerTy() && OldTy->isPointerTy())
return true;
if (NewTy->isIntegerTy() || OldTy->isIntegerTy())
return true;
return false;
}
return true;
}
Value *convertValue(IRBuilder<> &IRB, Value *V, Type *Ty) {
assert(canConvertValue(V->getType(), Ty) && "Value not convertable to type");
if (V->getType() == Ty)
return V;
if (V->getType()->isIntegerTy() && Ty->isPointerTy())
return IRB.CreateIntToPtr(V, Ty);
if (V->getType()->isPointerTy() && Ty->isIntegerTy())