History log of /llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp (Results 1 – 25 of 151)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 013f4a46 05-Nov-2024 Kazu Hirata <kazu@google.com>

[Utils] Remove unused includes (NFC) (#114748)

Identified with misc-include-cleaner.


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 3f222f3b 14-Jul-2024 c8ef <c8ef@outlook.com>

[NFC] Fix some typos (#98791)


# 9df71d76 28-Jun-2024 Nikita Popov <npopov@redhat.com>

[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)

Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, re

[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)

Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, replacing the
current `getParent()->getDataLayout()` pattern.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7
# 67aec0cd 27-May-2024 Peter Rong <peterrong96@gmail.com>

[LowerSwitch] Use unsigned integer for range comparison (#93237)

Commit 1db51d8eb2 switched from int64_t to `APInt` to prevent high precision integer overflow.
However, when comparing the "range" o

[LowerSwitch] Use unsigned integer for range comparison (#93237)

Commit 1db51d8eb2 switched from int64_t to `APInt` to prevent high precision integer overflow.
However, when comparing the "range" of switch cases, we should switch to unsigned integer to prevent overflow.
This patch fixes https://github.com/llvm/llvm-project/issues/93152.
Some test cases are added.

Signed-off-by: Peter Rong <PeterRong96@gmail.com>

show more ...


Revision tags: llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1
# 6b62a913 04-Mar-2024 Jeremy Morse <jeremy.morse@sony.com>

[RemoveDIs] Reapply 3fda50d3915, insert instructions using iterators

I'd reverted this in 6c7805d5d1 after a bad stage. Original commit
messsage follows:

[NFC][RemoveDIs] Bulk update utilities to i

[RemoveDIs] Reapply 3fda50d3915, insert instructions using iterators

I'd reverted this in 6c7805d5d1 after a bad stage. Original commit
messsage follows:

[NFC][RemoveDIs] Bulk update utilities to insert with iterators

As part of the RemoveDIs project we need LLVM to insert instructions using
iterators wherever possible, so that the iterators can carry a bit of
debug-info. This commit implements some of that by updating the contents of
llvm/lib/Transforms/Utils to always use iterator-versions of instruction
constructors.

There are two general flavours of update:
* Almost all call-sites just call getIterator on an instruction
* Several make use of an existing iterator (scenarios where the code is
actually significant for debug-info)
The underlying logic is that any call to getFirstInsertionPt or similar
APIs that identify the start of a block need to have that iterator passed
directly to the insertion function, without being converted to a bare
Instruction pointer along the way.

I've also switched DemotePHIToStack to take an optional iterator: it needs
to take an iterator, and having a no-insert-location behaviour appears to
be important. The constructors for ICmpInst and FCmpInst have been updated
too. They're the only instructions that take block _references_ rather than
pointers for certain calls, and a future patch is going to make use of
default-null block insertion locations.

All of this should be NFC.

show more ...


# 6c7805d5 29-Feb-2024 Jeremy Morse <jeremy.morse@sony.com>

Revert "[NFC][RemoveDIs] Bulk update utilities to insert with iterators"

This reverts commit 3fda50d3915b2163a54a37b602be7783a89dd808.

Apparently I've missed a hunk while staging this; will back ou

Revert "[NFC][RemoveDIs] Bulk update utilities to insert with iterators"

This reverts commit 3fda50d3915b2163a54a37b602be7783a89dd808.

Apparently I've missed a hunk while staging this; will back out for now.

Picked up here: https://lab.llvm.org/buildbot/#/builders/139/builds/60429/steps/6/logs/stdio

show more ...


# 3fda50d3 29-Feb-2024 Jeremy Morse <jeremy.morse@sony.com>

[NFC][RemoveDIs] Bulk update utilities to insert with iterators

As part of the RemoveDIs project we need LLVM to insert instructions using
iterators wherever possible, so that the iterators can carr

[NFC][RemoveDIs] Bulk update utilities to insert with iterators

As part of the RemoveDIs project we need LLVM to insert instructions using
iterators wherever possible, so that the iterators can carry a bit of
debug-info. This commit implements some of that by updating the contents of
llvm/lib/Transforms/Utils to always use iterator-versions of instruction
constructors.

There are two general flavours of update:
* Almost all call-sites just call getIterator on an instruction
* Several make use of an existing iterator (scenarios where the code is
actually significant for debug-info)
The underlying logic is that any call to getFirstInsertionPt or similar
APIs that identify the start of a block need to have that iterator passed
directly to the insertion function, without being converted to a bare
Instruction pointer along the way.

I've also switched DemotePHIToStack to take an optional iterator: it needs
to take an iterator, and having a no-insert-location behaviour appears to
be important. The constructors for ICmpInst and FCmpInst have been updated
too. They're the only instructions that take block _references_ rather than
pointers for certain calls, and a future patch is going to make use of
default-null block insertion locations.

All of this should be NFC.

show more ...


Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# 696cc20d 12-Dec-2023 Nikita Popov <npopov@redhat.com>

[LVI] Make UndefAllowed argument of getConstantRange() required

For the two remaining uses that did not explicitly specify it,
set UndefAllowed=false. In both cases, I believe that treating
undef as

[LVI] Make UndefAllowed argument of getConstantRange() required

For the two remaining uses that did not explicitly specify it,
set UndefAllowed=false. In both cases, I believe that treating
undef as a full range is the correct behavior.

show more ...


# a1642936 10-Dec-2023 Kazu Hirata <kazu@google.com>

[Transforms] Remove unnecessary includes (NFC)


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init
# 9b70a28e 12-Jan-2023 Peter Rong <PeterRong96@gmail.com>

[Transform] Rewrite LowerSwitch using APInt

This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.

Previously LowerSwitch uses int64_t, which will crash on case branches using intege

[Transform] Rewrite LowerSwitch using APInt

This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.

Previously LowerSwitch uses int64_t, which will crash on case branches using integers with more than 64 bits.
Using APInt fixes this problem. This patch also includes a test

Reviewed By: RKSimon

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

show more ...


Revision tags: llvmorg-15.0.7
# 1db51d8e 29-Dec-2022 Peter Rong <PeterRong96@gmail.com>

[Transform] Rewrite LowerSwitch using APInt

This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.

Previously LowerSwitch uses int64_t, which will crash on case branches using intege

[Transform] Rewrite LowerSwitch using APInt

This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.

Previously LowerSwitch uses int64_t, which will crash on case branches using integers with more than 64 bits.
Using APInt fixes this problem. This patch also includes a test

Reviewed By: RKSimon

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

show more ...


# 2838507b 02-Jan-2023 Peter Rong <PeterRong96@gmail.com>

precommit formatting of LowerSwitch.cpp for D140747

Signed-off-by: Peter Rong <PeterRong96@gmail.com>


# 32b38d24 15-Dec-2022 Vasileios Porpodas <vporpodas@google.com>

[NFC] Rename Instruction::insertAt() to Instruction::insertInto(), to be consistent with BasicBlock::insertInto()

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


# 80f2f1ea 14-Dec-2022 Vasileios Porpodas <vporpodas@google.com>

[NFC] Rename Function::insertBasicBlockAt() to Function::insert().

I think this is a better name because it is what STL uses.

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


# a19ae77d 12-Dec-2022 Vasileios Porpodas <vporpodas@google.com>

[IR][NFC] Adds Function::insertBasicBlockAt() to replace things like F->getBasicBlockList().insert()

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

Di

[IR][NFC] Adds Function::insertBasicBlockAt() to replace things like F->getBasicBlockList().insert()

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

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

show more ...


Revision tags: llvmorg-15.0.6
# 06911ba6 28-Nov-2022 Vasileios Porpodas <vporpodas@google.com>

[NFC] Cleanup: Replaces BB->getInstList().insert() with I->insertAt().

This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.

Differential Revision: https://r

[NFC] Cleanup: Replaces BB->getInstList().insert() with I->insertAt().

This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.

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

show more ...


# af4e856f 23-Nov-2022 Vasileios Porpodas <vporpodas@google.com>

[NFC] Replaced BB->getInstList().{erase(),pop_front(),pop_back()} with eraseFromParent().

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


Revision tags: llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2
# 1e01f950 12-Apr-2022 Ruiling Song <ruiling.song@amd.com>

LowerSwitch: Avoid inserting NewDefault block

The NewDefault was used to simplify the updating of PHI nodes, but it
causes some inefficiency for target that will run structurizer later. For
example,

LowerSwitch: Avoid inserting NewDefault block

The NewDefault was used to simplify the updating of PHI nodes, but it
causes some inefficiency for target that will run structurizer later. For
example, for a simple two-case switch, the extra NewDefault is causing
unstructured CFG like:

O
/ \
O O
/ \ / \
C1 ND C2
\ | /
\ | /
D

The change is to avoid the ND(NewDefault) block, that is we will get a
structured CFG for above example like:

O
/ \
/ \
O O
/ \ / \
C1 \ / C2
\-> D <-/

The IR change introduced by this patch should be trivial to other targets,
so I am doing this unconditionally.

Fall-through among the cases will also cause unstructured CFG, but it need
more work and will be addressed in a separate change.

Reviewed by: arsenm

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

show more ...


Revision tags: llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4
# 24c8eaec 16-Sep-2021 Kazu Hirata <kazu@google.com>

[Transforms] Use make_early_inc_range (NFC)


Revision tags: llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2
# b6211167 18-Dec-2020 Kazu Hirata <kazu@google.com>

[Transforms] Use llvm::erase_if (NFC)


Revision tags: llvmorg-11.0.1-rc1
# 1da60f1d 17-Nov-2020 Kazu Hirata <kazu@google.com>

[Transforms] Use pred_empty (NFC)


Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4
# 9b959b59 27-Sep-2020 Nikita Popov <nikita.ppv@gmail.com>

[LVI] Require context instruction in external API (NFCI)

Require CxtI in getConstant() and getConstantRange() APIs.
Accordingly drop the BB parameter, as it is implied by
CxtI->getParent().

This ma

[LVI] Require context instruction in external API (NFCI)

Require CxtI in getConstant() and getConstantRange() APIs.
Accordingly drop the BB parameter, as it is implied by
CxtI->getParent().

This makes sure we don't forget to pass the context instruction,
and makes the API contract clearer (also clean up the comments to
that effect -- the value holds at the context instruction, not
the end of the block).

show more ...


Revision tags: llvmorg-11.0.0-rc3
# f7aa1563 15-Sep-2020 Arthur Eubanks <aeubanks@google.com>

[LowerSwitch][NewPM] Port lowerswitch to NPM

Reviewed By: ychen

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


Revision tags: llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1
# 0128b950 24-Jul-2020 Simon Pilgrim <llvm-dev@redking.me.uk>

Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI."

This reverts commit 5dd566b7c7b78bd385418c72d63c79895be9ae97.

Causing some buildbot failures that

Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI."

This reverts commit 5dd566b7c7b78bd385418c72d63c79895be9ae97.

Causing some buildbot failures that I'm not seeing on MSVC builds.

show more ...


# 5dd566b7 24-Jul-2020 Simon Pilgrim <llvm-dev@redking.me.uk>

PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI.

PassManager.h is one of the top headers in the ClangBuildAnalyzer frontend worst offenders list.

This exposes a large number o

PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI.

PassManager.h is one of the top headers in the ClangBuildAnalyzer frontend worst offenders list.

This exposes a large number of implicit dependencies on various forward declarations/includes in other headers that need addressing.

show more ...


1234567