Re: [PATCH v2 00/27] LLVM fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 11, 2017 at 01:36:30PM +0000, Dibyendu Majumdar wrote:
> > Here you're hitting the OP_SET{EQ,...} case.
> >
> 
> Here is my attempt to fix:
> 
> static struct symbol *pseudo_get_type(pseudo_t pseudo) {
>  switch (pseudo->type) {
>  case PSEUDO_SYM:
>  case PSEUDO_ARG:
>   return pseudo->sym;
>  case PSEUDO_PHI:
>  case PSEUDO_REG:
>   return pseudo->def->type;
>  default:
>   assert(0);
>   return NULL;
>  }
> }
> static void output_op_compare(struct function *fn, struct instruction *insn)
> {
>  LLVMValueRef lhs, rhs, target;
>  char target_name[64];
>  if (insn->src1->type == PSEUDO_VAL)
>   lhs = val_to_value(fn, insn->src1->value, pseudo_get_type(insn->src2));
>  else
>   lhs = pseudo_to_value(fn, insn, insn->src1);
>  if (insn->src2->type == PSEUDO_VAL)
>   //rhs = LLVMConstInt(LLVMTypeOf(lhs), insn->src2->value, 1);
>   rhs = val_to_value(fn, insn->src2->value, pseudo_get_type(insn->src1));
>  else
>   rhs = pseudo_to_value(fn, insn, insn->src2);
> 
> 
> Does this look like the right thing to do?

I didn't tested it but it looks correct and it is certainly OK for now.
I made the patch "give a type to PSEUDO_ARGs" with this in mind.

I'll take it the others ones.

However I'm slowly looking at a more generic solution.
For example, it would certainly be easier if there would be a
OP_PTRCAST between a constant-value-used-as-a-pointer and its use.
The cost would be some missing optimizations, or more complex ones
or a sort of normalization pass.

-- Luc Van Oostenryck
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux