[PATCH][x86] Mark TEST8ri_NOREX hasSideEffects=0

Bob Wilson bob.wilson at apple.com
Wed Jul 9 18:27:47 PDT 2014


LGTM.

Even though the original issue no only occurs, the changes here are still the right thing to do. For the record, the original test was:

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f\
32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32\
:64-S128"
target triple = "x86_64-apple-macosx10.9.0"

define i32 @check_flag(i32 %flags, ...) nounwind {
entry:
  %and = and i32 %flags, 512
  %tobool = icmp eq i32 %and, 0
  br i1 %tobool, label %if.end, label %if.then

if.then:                                          ; preds = %entry
  br label %if.end

if.end:                                           ; preds = %entry, %if.then
  %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ]
  ret i32 %hasflag
}

> On Jul 7, 2014, at 3:07 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:
> 
> This patch marks the pattern-less pseudo-instruction TEST8ri_NOEREX as hasSIdeEffects=0 and adds a case clause for it in X86InstrInfo::shouldScheduleAdjacent to enable macro-fusion.
> 
> The original intent of this patch was to fix a bug where a testb instruction was scheduled apart from the je instruction that reads its result (this bug can be reproduced with r192750). It seems that this bug no longer occurs after the node ordering of selection DAG nodes was fixed, so I wasn't able to come up with the a test case.
> 
> <test8rinorex1.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list