summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorAiden Grossman <aidengrossman@google.com>2025-09-26 22:48:22 +0000
committerAiden Grossman <aidengrossman@google.com>2025-09-26 22:48:22 +0000
commit76533872e149395812a6d1651aa49dbf53fb4921 (patch)
tree199a669fa57a4effc3116705d2ec89c07ff36c65 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent54f5c1b2e17a9be61609d70dbbc8354ad41bb931 (diff)
parent37e7ad184d002db15f72771938755580433cf96d (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/boomanaiden154/main.lit-remove-t-from-tests
Created using spr 1.3.6 [skip ci]
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index d290f202f3cc..eb73d01b3558 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1749,6 +1749,12 @@ bool CodeGenPrepare::combineToUSubWithOverflow(CmpInst *Cmp,
Sub->hasNUsesOrMore(1)))
return false;
+ // We don't want to move around uses of condition values this late, so we
+ // check if it is legal to create the call to the intrinsic in the basic
+ // block containing the icmp.
+ if (Sub->getParent() != Cmp->getParent() && !Sub->hasOneUse())
+ return false;
+
if (!replaceMathCmpWithIntrinsic(Sub, Sub->getOperand(0), Sub->getOperand(1),
Cmp, Intrinsic::usub_with_overflow))
return false;