[all-commits] [llvm/llvm-project] dcdc1f: InstCombine: Can't fold a phi arg load into the ph...

Arnold Schwaighofer via All-commits all-commits at lists.llvm.org
Tue Mar 8 09:11:09 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dcdc1f29bb0cae41d5681183fdf57af8c51de907
      https://github.com/llvm/llvm-project/commit/dcdc1f29bb0cae41d5681183fdf57af8c51de907
  Author: Arnold Schwaighofer <aschwaighofer at apple.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
    M llvm/test/Transforms/InstCombine/phi-equal-incoming-pointers.ll

  Log Message:
  -----------
  InstCombine: Can't fold a phi arg load into the phi if the  load is from a swifterror address

`swifterror` addresses are only allowed as operands to load, store, and
calls.

The following transformation is not allowed. It would create a phi with a
`swifterror` address operand.

```
 %addr = alloca swifterror i8*
 br %cond, label %bb1, label %b22

 bb1:
   %val1 = load i8*, i8** %addr
   br exit

 bb2:
   %val2 = load i8*, i8** %addr
   br exit

 exit:
   %val = phi [%val1, %bb1] [%val2, %bb2]
```

=>

```
 %addr = alloca swifterror i8*
 br %cond, label %bb1, label %b22

 bb1:
   br exit

 bb2:
   br exit

 exit:
   %val_addr = phi [%addr, %bb1] [%addr, %bb2]
   %val2 = load i8*, i8** %val_addr
```

rdar://89865485

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




More information about the All-commits mailing list