diff options
| author | Craig Topper <craig.topper@sifive.com> | 2022-05-12 00:32:45 -0700 |
|---|---|---|
| committer | Craig Topper <craig.topper@sifive.com> | 2022-05-12 09:09:24 -0700 |
| commit | cec249c60dad84574fd53d2fbf158bfeef226777 (patch) | |
| tree | abd9ab5a6d5dcbf67984da4f0cf8b73f451452c9 /llvm/lib/CodeGen/TypePromotion.cpp | |
| parent | 40e965451151dadc46c3f41249edf4651015fda4 (diff) | |
[TypePromotion] Promote undef by converting to 0.
If we're promoting an undef I think that means that we expect the
upper bits are zero. undef doesn't guarantee that.
This patch replaces undef with 0 to ensure this. This matches how
a zext or sext of undef would be folded by InstCombine/InstSimplify.
I haven't found a failure from this was just thinking through the code.
Differential Revision: https://reviews.llvm.org/D123174
Diffstat (limited to 'llvm/lib/CodeGen/TypePromotion.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/TypePromotion.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TypePromotion.cpp b/llvm/lib/CodeGen/TypePromotion.cpp index fa7c797c70f0..cb0d99326201 100644 --- a/llvm/lib/CodeGen/TypePromotion.cpp +++ b/llvm/lib/CodeGen/TypePromotion.cpp @@ -489,7 +489,7 @@ void IRPromoter::PromoteTree() { : ConstantExpr::getZExt(Const, ExtTy); I->setOperand(i, NewConst); } else if (isa<UndefValue>(Op)) - I->setOperand(i, UndefValue::get(ExtTy)); + I->setOperand(i, ConstantInt::get(ExtTy, 0)); } // Mutate the result type, unless this is an icmp or switch. |
