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

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 27 08:46:28 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:

Yeah - I meant that if `ExtendType != InvalidShift` then does that mean that NeedExtend is always false? Is it ever possible to get to the emitAddSub_rx(..) line now?

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


More information about the llvm-commits mailing list