[PATCH] D52707: Switch optimization in IR for known maximum switch values

Ayonam Ray via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 16 07:36:54 PST 2018


ayonam updated this revision to Diff 178397.
ayonam added a comment.

@hans

The earlier code had a problem in that if we converted every switch that had an unreachable default, to omit the check for the default values beyond the maximum switch case value given in the code, then there were some corner cases where the code generated was semantically incorrect and resulted in runtime failures.  These failures are happening while compiling LLVM code itself.

So I have added a boolean in the SwitchInst class to mark switches that have been widened, so that we omit the branch only for those switches.  I need to explore the reasons for the behaviour that was observed when we were blindly removing the branch for all switches that had an unreachable default and will post a fix in a later patch.

Please review this and the other two patches 52002 and another one with the test case for this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52707/new/

https://reviews.llvm.org/D52707

Files:
  lib/Transforms/Utils/SimplifyCFG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52707.178397.patch
Type: text/x-patch
Size: 5647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181216/b23744cd/attachment.bin>


More information about the llvm-commits mailing list