[llvm] r225043 - [Hexagon] Changing an llvm_unreachable to an assertion and returning 0. Relocations aren't implemented yet but we don't need to abort for this in release builds.

David Blaikie dblaikie at gmail.com
Wed Dec 31 08:04:26 PST 2014


On Wed, Dec 31, 2014 at 7:57 AM, Colin LeMahieu <colinl at codeaurora.org>
wrote:

> Author: colinl
> Date: Wed Dec 31 09:57:38 2014
> New Revision: 225043
>
> URL: http://llvm.org/viewvc/llvm-project?rev=225043&view=rev
> Log:
> [Hexagon] Changing an llvm_unreachable to an assertion and returning 0.
> Relocations aren't implemented yet but we don't need to abort for this in
> release builds.
>
> Modified:
>     llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
>
> Modified:
> llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp?rev=225043&r1=225042&r2=225043&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
> (original)
> +++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
> Wed Dec 31 09:57:38 2014
> @@ -71,7 +71,8 @@ HexagonMCCodeEmitter::getMachineOpValue(
>      return MCT.getRegisterInfo()->getEncodingValue(MO.getReg());
>    if (MO.isImm())
>      return static_cast<unsigned>(MO.getImm());
> -  llvm_unreachable("Only Immediates and Registers implemented right now");
> +  assert(false && "Only Immediates and Registers implemented right now");
> +  return 0;
>

Pretty sure this isn't something idiomatic in LLVM - that return 0 is an
untested codepath & so not one we'd want to support. Either remove the
assertion & test the codepath (even if the test is just "we don't process
the relocation" with a FIXME saying we should - the test should fail when
the code is fixed here, so it's easy to locate the test case to update) in
all build modes, or leave the llvm_unreachable.

(at least I'm fairly sure that's the right thing to do)

- David


>  }
>
>  MCSubtargetInfo const &HexagonMCCodeEmitter::getSubtargetInfo() const {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141231/a09bcb91/attachment.html>


More information about the llvm-commits mailing list