[PATCH] D127712: Prevent crash when TurnSwitchRangeIntoICmp recieves default null dest
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 13 22:41:11 PDT 2022
aeubanks added a comment.
can you put the bug number (e.g. #12345) in the description?
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5190
+/// Switches with more than 2 destinations are ignored.
+/// Switches with 1 destation are also ignored.
bool SimplifyCFGOpt::TurnSwitchRangeIntoICmp(SwitchInst *SI,
----------------
destination
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5222
}
+ // All destinations are the same and the default is undef
+ if (!DestB) {
----------------
this comment makes it sound like at this point your comment is always true
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5223
+ // All destinations are the same and the default is undef
+ if (!DestB) {
+ return false;
----------------
LLVM style is no braces for a one line if
================
Comment at: llvm/test/Transforms/SimplifyCFG/switch-default-undef.ll:1
+; RUN: opt -passes=simplifycfg"<switch-range-to-icmp>" -S %s | FileCheck %s
+
----------------
can you use `llvm/utils/update_test_checks.py`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127712/new/
https://reviews.llvm.org/D127712
More information about the llvm-commits
mailing list