[PATCH] D117184: Fix failing assertion in SimplifyCFG.cpp as icmp gep fold to constant expression [NFC]

praveen velliengiri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 22:46:41 PST 2022


pvellien created this revision.
pvellien added a reviewer: nikic.
Herald added a subscriber: hiraditya.
pvellien requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

  [[ https://reviews.llvm.org/D116332 | Make icmp of gep fold offset based ]]  fold icmp of gep with globals variables, to a constant expression. This fails an assertion in reuseTableCompare function in SimplifyCFG.cpp where the expectation is either a true constant or a false constant, since now it can return a icmp constant expression which result is either a true or a false, we can remove that assertion without any functional changes to the code. 


https://reviews.llvm.org/D117184

Files:
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -5797,8 +5797,6 @@
                                                 ValuePair.second, CmpOp1, true);
     if (!CaseConst || CaseConst == DefaultConst || isa<UndefValue>(CaseConst))
       return;
-    assert((CaseConst == TrueConst || CaseConst == FalseConst) &&
-           "Expect true or false as compare result.");
   }
 
   // Check if the branch instruction dominates the phi node. It's a simple


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117184.399545.patch
Type: text/x-patch
Size: 614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/1f759186/attachment.bin>


More information about the llvm-commits mailing list