[llvm-commits] [llvm] r119705 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp
Chris Lattner
clattner at apple.com
Thu Nov 18 23:27:20 PST 2010
On Nov 18, 2010, at 10:38 AM, Duncan Sands wrote:
> Hi Dan,
>
>> Use llvm_unreachable for "impossible" situations.
>
> isn't that what assertions are for?
Yes, llvm_unreachable shouldn't be used in clearly reachable situations like this, assert(0) can. Also, since llvm_unreachable is noreturn, if it stays, the return after them should be removed.
-Chris
>
> Ciao,
>
> Duncan.
>
>>
>> Modified:
>> llvm/trunk/lib/Analysis/PHITransAddr.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=119705&r1=119704&r2=119705&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original)
>> +++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Thu Nov 18 11:05:57 2010
>> @@ -15,6 +15,7 @@
>> #include "llvm/Analysis/Dominators.h"
>> #include "llvm/Analysis/InstructionSimplify.h"
>> #include "llvm/Support/Debug.h"
>> +#include "llvm/Support/ErrorHandling.h"
>> #include "llvm/Support/raw_ostream.h"
>> using namespace llvm;
>>
>> @@ -66,9 +67,10 @@
>> // If it isn't in the InstInputs list it is a subexpr incorporated into the
>> // address. Sanity check that it is phi translatable.
>> if (!CanPHITrans(I)) {
>> - errs()<< "Non phi translatable instruction found in PHITransAddr, either"
>> - "something is missing from InstInputs or CanPHITrans is wrong:\n";
>> + errs()<< "Non phi translatable instruction found in PHITransAddr:\n";
>> errs()<< *I<< '\n';
>> + llvm_unreachable("Either something is missing from InstInputs or "
>> + "CanPHITrans is wrong.");
>> return false;
>> }
>>
>> @@ -92,9 +94,10 @@
>> return false;
>>
>> if (!Tmp.empty()) {
>> - errs()<< "PHITransAddr inconsistent, contains extra instructions:\n";
>> + errs()<< "PHITransAddr contains extra instructions:\n";
>> for (unsigned i = 0, e = InstInputs.size(); i != e; ++i)
>> errs()<< " InstInput #"<< i<< " is "<< *InstInputs[i]<< "\n";
>> + llvm_unreachable("This is unexpected.");
>> return false;
>> }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list