[PATCH] MCInstrAnalysis::evaluateBranch() silently fails without asserts

Ahmed Bougacha ahmed.bougacha at gmail.com
Wed Oct 16 14:34:37 PDT 2013

On Wed, Oct 16, 2013 at 11:07 AM, Stephen Checkoway <s at pahtak.org> wrote:
> MCInstrAnalysis::evaluateBranch() was assuming that if the OperandType is MCOI::OPERAND_PCREL, then the operand was an immediate. This appears not to be the case.
> I'm unsure if this is handling it correctly or if we should just give up immediately if it's not an immediate or something else.

There was a patch attempt some time ago
(http://thread.gmane.org/gmane.comp.compilers.llvm.cvs/148669), but
this area didn't change a lot as far as I remember. The gist of it:

- the problem is in the way -cfg and -symbolize interact. -cfg doesn't
expect a symbolized disassembly. -symbolize enables the MC*Symbolizer
in llvm-objdump's MCDisassembler. Eventually it will be very useful to
handle symbolized MCInsts, but, as is, the easy (/hacky) fix would
probably be to move the -symbolize block in llvm-objdump after the
-cfg block.

- evaluating symbols in MCInstrAnalysis is the right thing to do, but
it requires that the symbols created by the Symbolizer are assigned
correct addresses.

Hope it helps, I'm sorry I can't spend more time on this.

- Ahmed

> I don't know how to write a test case for this since the assert only triggers in Debug.
> --
> Stephen Checkoway
> _______________________________________________
> 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