Skip to content

Conversation

@sivakusayan
Copy link
Contributor

Closes #172176.

Previously, FoldOpIntoSelect wouldn't fold multi-use selects if MultiUse wasn't explicitly true. This prevents useful folding when the select is used multiple times in the same intrinsic call. Similar to what is done in foldOpIntoPhi, we'll now check that all of the uses come from a single user, rather than checking that there is only one use.

@github-actions
Copy link

⚠️ undef deprecator found issues in your code. ⚠️

You can test this locally with the following command:
git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef([^a-zA-Z0-9_-]|$)|UndefValue::get)' 'HEAD~1' HEAD llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/test/Transforms/InstCombine/intrinsic-select.ll

The following files introduce new uses of undef:

  • llvm/test/Transforms/InstCombine/intrinsic-select.ll

Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields undef. You should use poison values for placeholders instead.

In tests, avoid using undef and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:

define void @fn() {
  ...
  br i1 undef, ...
}

Please use the following instead:

define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}

Please refer to the Undefined Behavior Manual for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[missed-opt] [instcombine] fshl/fshr not pushed into constant-argument phi

1 participant