[llvm] [FastISel][AArch64] Compare Instruction Miscompilation Fix (PR #75993)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 00:21:08 PST 2023


================
@@ -1233,7 +1233,11 @@ unsigned AArch64FastISel::emitAddSub(bool UseAdd, MVT RetVT, const Value *LHS,
       isValueAvailable(RHS)) {
     if (const auto *SI = dyn_cast<BinaryOperator>(RHS))
       if (const auto *C = dyn_cast<ConstantInt>(SI->getOperand(1)))
-        if ((SI->getOpcode() == Instruction::Shl) && (C->getZExtValue() < 4)) {
+        if ((SI->getOpcode() == Instruction::Shl) && (C->getZExtValue() < 4) &&
+            !NeedExtend) {
+          // We can only fold instructions that doesn't need extension because
----------------
davemgreen wrote:

Is it possible to reach this point now, if NeedExtend==false and ExtendType != AArch64_AM::InvalidShiftExtend?

https://github.com/llvm/llvm-project/pull/75993


More information about the llvm-commits mailing list