diff options
| author | Nemanja Ivanovic <nemanja.i.ibm@gmail.com> | 2018-02-22 03:02:41 +0000 | 
|---|---|---|
| committer | Nemanja Ivanovic <nemanja.i.ibm@gmail.com> | 2018-02-22 03:02:41 +0000 | 
| commit | e54a9ee8ac721a3ebf427f64b598154e1dda917b (patch) | |
| tree | 5d0780168c7971640497737c7f269fba46df65cc /llvm/lib/Target/PowerPC | |
| parent | 1ceabcf080b4e46681554a23273018b15576536c (diff) | |
| download | bcm5719-llvm-e54a9ee8ac721a3ebf427f64b598154e1dda917b.tar.gz bcm5719-llvm-e54a9ee8ac721a3ebf427f64b598154e1dda917b.zip  | |
[PowerPC] Do not produce invalid CTR loop with an FRem
An FRem instruction inside a loop should prevent the loop from being converted
into a CTR loop since this is not an operation that is legal on any PPC
subtarget. This will always be a call to a library function which means the
loop will be invalid if this instruction is in the body.
Fixes PR36292.
llvm-svn: 325739
Diffstat (limited to 'llvm/lib/Target/PowerPC')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCCTRLoops.cpp | 5 | 
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp index ae9b8c518d5..6443447e70c 100644 --- a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp +++ b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp @@ -455,13 +455,16 @@ bool PPCCTRLoops::mightUseCTR(BasicBlock *BB) {          return true;      } +    // FREM is always a call. +    if (J->getOpcode() == Instruction::FRem) +      return true; +      if (STI->useSoftFloat()) {        switch(J->getOpcode()) {        case Instruction::FAdd:        case Instruction::FSub:        case Instruction::FMul:        case Instruction::FDiv: -      case Instruction::FRem:        case Instruction::FPTrunc:        case Instruction::FPExt:        case Instruction::FPToUI:  | 

