[PATCH] D125294: [TypePromotion] Fix sext vs zext in promoted constant
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 02:47:58 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5feeceddb2b5: [TypePromotion] Fix sext vs zext in promoted constant (authored by dmgreen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125294/new/
https://reviews.llvm.org/D125294
Files:
llvm/lib/CodeGen/TypePromotion.cpp
llvm/test/Transforms/TypePromotion/ARM/icmps.ll
Index: llvm/test/Transforms/TypePromotion/ARM/icmps.ll
===================================================================
--- llvm/test/Transforms/TypePromotion/ARM/icmps.ll
+++ llvm/test/Transforms/TypePromotion/ARM/icmps.ll
@@ -348,3 +348,16 @@
if.end:
ret void
}
+
+define i32 @degenerateicmp() {
+; CHECK-LABEL: @degenerateicmp(
+; CHECK-NEXT: [[TMP1:%.*]] = sub i32 190, 0
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ugt i32 225, [[TMP1]]
+; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP2]], i32 1, i32 0
+; CHECK-NEXT: ret i32 [[TMP3]]
+;
+ %1 = sub i8 -66, 0
+ %2 = icmp ugt i8 -31, %1
+ %3 = select i1 %2, i32 1, i32 0
+ ret i32 %3
+}
Index: llvm/lib/CodeGen/TypePromotion.cpp
===================================================================
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -484,7 +484,7 @@
continue;
if (auto *Const = dyn_cast<ConstantInt>(Op)) {
- Constant *NewConst = SafeWrap.contains(I)
+ Constant *NewConst = (SafeWrap.contains(I) && i == 1)
? ConstantExpr::getSExt(Const, ExtTy)
: ConstantExpr::getZExt(Const, ExtTy);
I->setOperand(i, NewConst);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125294.428599.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220511/1e872a3a/attachment.bin>
More information about the llvm-commits
mailing list