Details
Details
- Reviewers
nlopes lebedev.ri spatel RKSimon
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
What we need to do here is "define" undef to be 0.
---------------------------------------- define <4 x i5> @test_v4i5_not_ashr_negative_const_undef(<4 x i5> %a0) { %0: %1 = ashr <4 x i5> { 29, 27, undef, 23 }, %a0 %2 = xor <4 x i5> { 31, 31, 31, undef }, %1 ret <4 x i5> %2 } => define <4 x i5> @test_v4i5_not_ashr_negative_const_undef(<4 x i5> %a0) { %0: %1 = lshr <4 x i5> { 2, 4, 0, 8 }, %a0 ret <4 x i5> %1 } Transformation seems to be correct! Summary: 1 correct transformations 0 incorrect transformations 0 Alive2 errors
There was some utility for that already, but i don't recall how it's called..
Comment Actions
Probably want this:
/// Some binary operators require special handling to avoid poison and undefined /// behavior. If a constant vector has undef elements, replace those undefs with /// identity constants if possible because those are always safe to execute. /// If no identity constant exists, replace undef with some other safe constant. static inline Constant *getSafeVectorConstantForBinop()
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | ||
---|---|---|
3071–3072 | m_Negative uses cst_pred_ty internally which just continues if it finds an undef in a vector - maybe we don't want that? |
Comment Actions
Yes, i think that's the one.
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | ||
---|---|---|
3071–3072 | We only need to handle undefs correctly, we don't need to completely give up on them here. |
m_Negative uses cst_pred_ty internally which just continues if it finds an undef in a vector - maybe we don't want that?