[PATCH] D156444: [llvm][RISCV][IR] Zext flag in IR for RISC-V

Panagiotis K via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 30 00:19:29 PDT 2023


karouzakisp added a comment.

In D156444#4652045 <https://reviews.llvm.org/D156444#4652045>, @nikic wrote:

> In D156444#4652044 <https://reviews.llvm.org/D156444#4652044>, @karouzakisp wrote:
>
>> In D156444#4650274 <https://reviews.llvm.org/D156444#4650274>, @nikic wrote:
>>
>>> The semantics need to be a change to llvm/docs/LangRef.rst in this patch, not a comment.
>>>
>>> As I said before, I don't think it makes sense to add nneg support to zext constant expressions, which are slated for removal.
>>
>> Refactoring NonNeg Operator and removing all zext constant expressions leads to 3 test failing due to the inheritance graph:
>> NonNeg Operator is Operator and Operator is User and ConstantExpr is a Constant and Constant is User too.
>> So the User class must be refactored too to not support ConstantExpr in general.
>
> Yes, Operator is for cases that support Instruction and ConstantExpr. You would change NonNegOperator -> NonNegInstruction/NonNegInst (if you need it at all, it would only have the classof check for zext and nothing else).

Yes I have done that and still the 3 tests fail, inheriting from User directly, instead of Operator.
and I get --> " decltype(auto) llvm::cast(From*) [with To = llvm::NonNegOperator; From = const llvm::Operator]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. "

Basically I used operator to set/get the flag similarly to all the other flags but now those support ConstantExpr.
and I think that's the problem.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156444/new/

https://reviews.llvm.org/D156444



More information about the llvm-commits mailing list