[llvm] r262455 - Bug 20810: Use report_fatal_error instead of unreachable

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 15:12:16 PST 2016


This is not how we split llvm_unreachable/report_fatal_error in llvm
and I don't think r600 should be an exception.

If this code is known to be buggy, add a note for potential users
saying that they should build with assertions and report bugs.

It is still the case that report_fatal_error is for valid errors.
llvm_unreachable is for detecting *bugs* in the code.

Cheers,
Rafael



On 1 March 2016 at 22:33, Matt Arsenault via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: arsenm
> Date: Tue Mar  1 21:33:55 2016
> New Revision: 262455
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262455&view=rev
> Log:
> Bug 20810: Use report_fatal_error instead of unreachable
>
> Modified:
>     llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
>
> Modified: llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp?rev=262455&r1=262454&r2=262455&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp (original)
> +++ llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp Tue Mar  1 21:33:55 2016
> @@ -923,7 +923,7 @@ bool AMDGPUCFGStructurizer::run() {
>
>    if (!Finish) {
>      DEBUG(FuncRep->viewCFG());
> -    llvm_unreachable("IRREDUCIBLE_CFG");
> +    report_fatal_error("IRREDUCIBLE_CFG");
>    }
>
>    return true;
> @@ -1413,10 +1413,10 @@ int AMDGPUCFGStructurizer::improveSimple
>    MachineBasicBlock::iterator I = insertInstrBefore(LandBlk, AMDGPU::ENDIF);
>
>    if (LandBlkHasOtherPred) {
> -    llvm_unreachable("Extra register needed to handle CFG");
> +    report_fatal_error("Extra register needed to handle CFG");
>      unsigned CmpResReg =
>        HeadMBB->getParent()->getRegInfo().createVirtualRegister(I32RC);
> -    llvm_unreachable("Extra compare instruction needed to handle CFG");
> +    report_fatal_error("Extra compare instruction needed to handle CFG");
>      insertCondBranchBefore(LandBlk, I, AMDGPU::IF_PREDICATE_SET,
>          CmpResReg, DebugLoc());
>    }
> @@ -1433,7 +1433,7 @@ int AMDGPUCFGStructurizer::improveSimple
>      // need to uncondionally insert the assignment to ensure a path from its
>      // predecessor rather than headBlk has valid value in initReg if
>      // (initVal != 1).
> -    llvm_unreachable("Extra register needed to handle CFG");
> +    report_fatal_error("Extra register needed to handle CFG");
>    }
>    insertInstrBefore(I, AMDGPU::ELSE);
>
> @@ -1442,7 +1442,7 @@ int AMDGPUCFGStructurizer::improveSimple
>      // need to uncondionally insert the assignment to ensure a path from its
>      // predecessor rather than headBlk has valid value in initReg if
>      // (initVal != 0)
> -    llvm_unreachable("Extra register needed to handle CFG");
> +    report_fatal_error("Extra register needed to handle CFG");
>    }
>
>    if (LandBlkHasOtherPred) {
> @@ -1454,7 +1454,7 @@ int AMDGPUCFGStructurizer::improveSimple
>           PE = LandBlk->pred_end(); PI != PE; ++PI) {
>        MachineBasicBlock *MBB = *PI;
>        if (MBB != TrueMBB && MBB != FalseMBB)
> -        llvm_unreachable("Extra register needed to handle CFG");
> +        report_fatal_error("Extra register needed to handle CFG");
>      }
>    }
>    DEBUG(
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list