[test-suite] r190848 - Fix undefined behaviour by moving safety test before the memory loads. Patch

Nick Lewycky nicholas at mxc.ca
Mon Sep 16 22:26:08 PDT 2013


Author: nicholas
Date: Tue Sep 17 00:26:07 2013
New Revision: 190848

URL: http://llvm.org/viewvc/llvm-project?rev=190848&view=rev
Log:
Fix undefined behaviour by moving safety test before the memory loads. Patch
by Jim Stichnoth!

Modified:
    test-suite/trunk/MultiSource/Applications/aha/aha.c

Modified: test-suite/trunk/MultiSource/Applications/aha/aha.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/aha/aha.c?rev=190848&r1=190847&r2=190848&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Applications/aha/aha.c (original)
+++ test-suite/trunk/MultiSource/Applications/aha/aha.c Tue Sep 17 00:26:07 2013
@@ -248,9 +248,10 @@ more unused computed values; it hasn't b
          pgm[i].opnd[0] = rs;
       }
       rt = rs - 1;              // Third from last reg.
-      if (pgm[i-1].opnd[0] != rt && pgm[i-1].opnd[1] != rt &&
+      if (rt >= RI0 &&
+         pgm[i-1].opnd[0] != rt && pgm[i-1].opnd[1] != rt &&
          pgm[i-1].opnd[2] != rt && pgm[i].opnd[1] != rt &&
-         pgm[i].opnd[2] != rt && rt >= RI0) {
+         pgm[i].opnd[2] != rt) {
 
          // The last instruction needs to reference rt.
 





More information about the llvm-commits mailing list