[llvm] 1fd6611 - [SelectionDAG] Restore calls to has_value (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 10 14:37:30 PDT 2022


Author: Kazu Hirata
Date: 2022-07-10T14:37:23-07:00
New Revision: 1fd6611fc8802479a8bd03431a0541ad207ce7b9

URL: https://github.com/llvm/llvm-project/commit/1fd6611fc8802479a8bd03431a0541ad207ce7b9
DIFF: https://github.com/llvm/llvm-project/commit/1fd6611fc8802479a8bd03431a0541ad207ce7b9.diff

LOG: [SelectionDAG] Restore calls to has_value (NFC)

This patch restores calls to has_value to make it clear that we are
checking the presence of an optional value, not the underlying value.

This patch partially reverts d08f34b592ff06ccb1f36da88ec09aa926427a4d.

Differential Revision: https://reviews.llvm.org/D129454

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4736b9dd6aace..524fb0b8800a8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -24536,8 +24536,9 @@ bool DAGCombiner::mayAlias(SDNode *Op0, SDNode *Op1) const {
   auto &Size0 = MUC0.NumBytes;
   auto &Size1 = MUC1.NumBytes;
   if (OrigAlignment0 == OrigAlignment1 && SrcValOffset0 != SrcValOffset1 &&
-      Size0 && Size1 && *Size0 == *Size1 && OrigAlignment0 > *Size0 &&
-      SrcValOffset0 % *Size0 == 0 && SrcValOffset1 % *Size1 == 0) {
+      Size0.has_value() && Size1.has_value() && *Size0 == *Size1 &&
+      OrigAlignment0 > *Size0 && SrcValOffset0 % *Size0 == 0 &&
+      SrcValOffset1 % *Size1 == 0) {
     int64_t OffAlign0 = SrcValOffset0 % OrigAlignment0.value();
     int64_t OffAlign1 = SrcValOffset1 % OrigAlignment1.value();
 


        


More information about the llvm-commits mailing list