1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
llvm-mirror/include/llvm
Sanjoy Das 9baaae9344 [SCEV] Don't always add no-wrap flags to post-inc add recs
Fixes PR27315.

The post-inc version of an add recurrence needs to "follow the same
rules" as a normal add or subtract expression.  Otherwise we miscompile
programs like

```
int main() {
  int a = 0;
  unsigned a_u = 0;
  volatile long last_value;
  do {
    a_u += 3;
    last_value = (long) ((int) a_u);
    if (will_add_overflow(a, 3)) {
      // Leave, and don't actually do the increment, so no UB.
      printf("last_value = %ld\n", last_value);
      exit(0);
    }
    a += 3;
  } while (a != 46);
  return 0;
}
```

This patch changes SCEV to put no-wrap flags on post-inc add recurrences
only when the poison from a potential overflow will go ahead to cause
undefined behavior.

To avoid regressing performance too much, I've assumed infinite loops
without side effects is undefined behavior to prove poison<->UB
equivalence in more cases.  This isn't ideal, but is not new to LLVM as
a whole, and far better than the situation I'm trying to fix.

llvm-svn: 271151
2016-05-29 00:32:17 +00:00
..
ADT SmallVector: Replace some pre-C++11 move helpers with standard algorithms 2016-05-27 19:05:14 +00:00
Analysis [SCEV] Don't always add no-wrap flags to post-inc add recs 2016-05-29 00:32:17 +00:00
AsmParser [AsmParser] Expose an API to parse a string starting with a type. 2016-03-08 00:37:07 +00:00
Bitcode Restore "[ThinLTO] Emit individual index files for distributed backends" 2016-05-10 13:48:23 +00:00
CodeGen MachineScheduler: Introduce ONLY1 reason to improve debug output 2016-05-27 22:14:26 +00:00
Config Add the printing the Mach-O (__LLVM,__bundle) xar archive file section "verbosely" 2016-05-23 21:34:12 +00:00
DebugInfo [CVSymbolVisitor] It's possible for an error to occur in begin() 2016-05-28 19:45:54 +00:00
ExecutionEngine Make header self-contained. NFC. 2016-05-27 15:21:30 +00:00
IR [X86][SSE] (Reapplied) Replace (V)PMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (llvm) 2016-05-28 18:03:41 +00:00
IRReader [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
LibDriver [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
LineEditor Apply clang-tidy's misc-move-constructor-init throughout LLVM. 2016-05-27 14:27:24 +00:00
Linker Linker: teach the IR mover to return llvm::Error. 2016-05-27 05:21:35 +00:00
LTO [ThinLTO] Refactor ODR resolution and internalization (NFC) 2016-05-25 14:03:11 +00:00
MC [MC] Support symbolic expressions in assembly directives 2016-05-28 05:57:48 +00:00
Object Apply clang-tidy's misc-move-constructor-init throughout LLVM. 2016-05-27 14:27:24 +00:00
ObjectYAML [obj2yaml][yaml2obj] Support for MachO lazy bindings 2016-05-26 21:29:39 +00:00
Option Option parser: class for consuming a joined arg in addition to all remaining args 2016-04-15 00:23:30 +00:00
Passes [PM] Refactor cross-registration of AM into an helper. 2016-05-14 23:21:50 +00:00
ProfileData [ProfData] Remove global constructor from ProfileSummaryBuilder. 2016-05-27 17:38:16 +00:00
Support [Timer] Add missing slash in doxygen commit. 2016-05-27 20:04:16 +00:00
TableGen Reverting r263474; it turns out there are uses of the public interface, but MSVC wasn't caring about them. 2016-03-14 20:03:15 +00:00
Target Target: move enum back into MC 2016-05-20 05:13:35 +00:00
Transforms [PM] Port the Sample FDO to new PM (part-2) 2016-05-27 23:20:16 +00:00
CMakeLists.txt
InitializePasses.h [PM] Port the Sample FDO to new PM (part-1) 2016-05-27 22:30:44 +00:00
LinkAllIR.h Remove every uses of getGlobalContext() in LLVM (but the C API) 2016-04-14 21:59:01 +00:00
LinkAllPasses.h New pass: guard widening 2016-05-18 22:55:34 +00:00
module.modulemap Add new .def file to module map. 2016-05-26 20:13:50 +00:00
module.modulemap.build
Pass.h Remove unused header. 2016-05-25 22:56:58 +00:00
PassAnalysisSupport.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
PassInfo.h Reformat partially. 2015-10-05 04:46:30 +00:00
PassRegistry.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
PassSupport.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00