This change fixes the crash that PRValue cannot be handled by
EmitLValue.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2103 | I don't think it's legal to use EmitLValue here at all; the emitted IR could have side-effects. Since we have the vector insert/extract intrinsics now, can we just use them here instead of going through the load/store dance? |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2103 |
I agree since we have already visited E.
we have already use insert/extract intrinsics for same element type, we can only handle predicate cast through memory. |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2103 | I'd be happy to accept just unconditionally doing the alloca+store+load thing for now. Not sure I understand why predicates are special here. Even if we can't handle predicates directly in insert/extract intrinsics, we can always just zero-extend to a bigger integer type, do the cast, then truncate the result. |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2103 | I'm not sure whether zext+cast+trunc to vxi1 can generate better code. I think it is better to handle this in llvm ir without extend and truncate, only bitcast and insert/extract |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2103 | I don't think we need to call getCallReturnType() here. A call that returns a reference is an lvalue, and the code here expects an rvalue. So CE->getCallReturnType() is going to be the same as E->getType(). |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2103 | make sense to me, thanks! |
LGTM
clang/test/CodeGen/attr-arm-sve-vector-bits-globals.c | ||
---|---|---|
108 | Oh, hmm, this is the case where we can't optimize. We could probably teach instcombine to convert this pattern into a load directly from the global, if it matters. |
clang/test/CodeGen/attr-arm-sve-vector-bits-globals.c | ||
---|---|---|
108 | yep, we can also convert to bitcast + vector.insert when without vscale_range . I'll check the codegen of rvv see whether it has any difference. |
I don't think it's legal to use EmitLValue here at all; the emitted IR could have side-effects.
Since we have the vector insert/extract intrinsics now, can we just use them here instead of going through the load/store dance?